llvm.org GIT mirror llvm / 204f8c0
[NewGVN] Create a StoreExpression instead of a VariableExpression. In the case where we have an operand defined by a lod of the same memory location. Historically this was a VariableExpression because we wanted to make sure they ended up in the same class, but if we create the right expression, they end up in the same class anyway. Fixes PR32897. Thanks to Dan for the detailed discussion and the fix suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303475 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 27 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
12501250 lookupOperandLeader(SI->getPointerOperand())) &&
12511251 (lookupMemoryLeader(getMemoryAccess(LI)->getDefiningAccess()) ==
12521252 StoreRHS))
1253 return createVariableExpression(LI);
1253 return createStoreExpression(SI, StoreRHS);
12541254 }
12551255 }
12561256
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -S -newgvn %s | FileCheck %s
2
3 define void @tinkywinky(i64* %b) {
4 ; CHECK-LABEL: @tinkywinky(
5 ; CHECK-NEXT: entry:
6 ; CHECK-NEXT: br label [[BODY:%.*]]
7 ; CHECK: body:
8 ; CHECK-NEXT: store i64 undef, i64* [[B:%.*]]
9 ; CHECK-NEXT: [[B2:%.*]] = load i64, i64* [[B]]
10 ; CHECK-NEXT: br i1 undef, label [[BODY]], label [[END:%.*]]
11 ; CHECK: end:
12 ; CHECK-NEXT: br label [[BODY]]
13 ;
14 entry:
15 br label %body
16 body:
17 %d.1 = phi i64* [ undef, %entry ], [ %d.1, %body ], [ %b, %end ]
18 store i64 undef, i64* %d.1
19 %b2 = load i64, i64* %b
20 %or = or i64 %b2, 0
21 store i64 %or, i64* %b
22 br i1 undef, label %body, label %end
23 end:
24 br label %body
25 }