llvm.org GIT mirror llvm / 049d08f
Make sure we don't return bits outside the mask in ComputeMaskedBits. PR12189. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152066 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 7 years ago
2 changed file(s) with 24 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
690690 if (P->hasConstantValue() == P)
691691 break;
692692
693 KnownZero = APInt::getAllOnesValue(BitWidth);
694 KnownOne = APInt::getAllOnesValue(BitWidth);
693 KnownZero = Mask;
694 KnownOne = Mask;
695695 for (unsigned i = 0, e = P->getNumIncomingValues(); i != e; ++i) {
696696 // Skip direct self references.
697697 if (P->getIncomingValue(i) == P) continue;
0 ; RUN: opt < %s -instsimplify -S | FileCheck %s
1
2 ; PR12189
3 define i1 @test1(i32 %x) {
4 ; CHECK: @test1
5 br i1 true, label %a, label %b
6
7 a:
8 %aa = or i32 %x, 10
9 br label %c
10
11 b:
12 %bb = or i32 %x, 10
13 br label %c
14
15 c:
16 %cc = phi i32 [ %bb, %b ], [%aa, %a ]
17 %d = urem i32 %cc, 2
18 %e = icmp eq i32 %d, 0
19 ret i1 %e
20 ; CHECK: ret i1 %e
21 }