llvm.org GIT mirror llvm / 6ff9a78
[NewGVN] Update additionalUsers when we simplify to a value. Otherwise we don't revisit an instruction that could be simplified, and when we verify, we discover there's something that changed, i.e. what we had wasn't a maximal fixpoint. Fixes PR32836. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303715 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 49 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
954954
955955 CongruenceClass *CC = ValueToClass.lookup(V);
956956 if (CC && CC->getDefiningExpr()) {
957 // If we simplified to something else, we need to communicate
958 // that we're users of the value we simplified to.
959 if (I != V)
960 addAdditionalUsers(V, I);
957961 if (I)
958962 DEBUG(dbgs() << "Simplified " << *I << " to "
959963 << " expression " << *CC->getDefiningExpr() << "\n");
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -S -newgvn %s | FileCheck %s
2
3 %struct.anon = type { i32 }
4 @b = external global %struct.anon
5 define void @tinkywinky(i1 %patatino) {
6 ; CHECK-LABEL: @tinkywinky(
7 ; CHECK-NEXT: store i32 8, i32* null
8 ; CHECK-NEXT: br i1 [[PATATINO:%.*]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
9 ; CHECK: if.then:
10 ; CHECK-NEXT: br label [[L:%.*]]
11 ; CHECK: L:
12 ; CHECK-NEXT: br label [[IF_END]]
13 ; CHECK: if.end:
14 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* null
15 ; CHECK-NEXT: [[BF_LOAD1:%.*]] = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @b, i64 0, i32 0)
16 ; CHECK-NEXT: [[BF_VALUE:%.*]] = and i32 [[TMP1]], 536870911
17 ; CHECK-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -536870912
18 ; CHECK-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
19 ; CHECK-NEXT: store i32 [[BF_SET]], i32* getelementptr inbounds (%struct.anon, %struct.anon* @b, i64 0, i32 0)
20 ; CHECK-NEXT: br label [[LOR_END:%.*]]
21 ; CHECK: lor.end:
22 ; CHECK-NEXT: br label [[L]]
23 ;
24 store i32 8, i32* null
25 br i1 %patatino, label %if.end, label %if.then
26 if.then:
27 store i32 8, i32* null
28 br label %L
29 L:
30 br label %if.end
31 if.end:
32 %tmp1 = load i32, i32* null
33 %bf.load1 = load i32, i32* getelementptr (%struct.anon, %struct.anon* @b, i64 0, i32 0)
34 %bf.value = and i32 %tmp1, 536870911
35 %bf.clear = and i32 %bf.load1, -536870912
36 %bf.set = or i32 %bf.clear, %bf.value
37 store i32 %bf.set, i32* getelementptr (%struct.anon, %struct.anon* @b, i64 0, i32 0)
38 br label %lor.end
39 lor.end:
40 %bf.load4 = load i32, i32* getelementptr (%struct.anon, %struct.anon* @b, i64 0, i32 0)
41 %tmp4 = and i32 %bf.load4, 536870911
42 %or = or i32 0, %tmp4
43 br label %L
44 }