File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
test/Transforms/DeadStoreElimination Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2116,7 +2116,9 @@ struct DSEState {
21162116 return true ;
21172117
21182118 if (auto *LoadI = dyn_cast<LoadInst>(Store->getOperand (0 ))) {
2119- if (LoadI->getPointerOperand () == Store->getOperand (1 )) {
2119+ if (LoadI->getPointerOperand () == Store->getOperand (1 ) ||
2120+ AA.isMustAlias (MemoryLocation::get (LoadI),
2121+ MemoryLocation::get (Store))) {
21202122 // Get the defining access for the load.
21212123 auto *LoadAccess = MSSA.getMemoryAccess (LoadI)->getDefiningAccess ();
21222124 // Fast path: the defining accesses are the same.
Original file line number Diff line number Diff line change @@ -1152,3 +1152,14 @@ if.else:
11521152end:
11531153 ret void
11541154}
1155+
1156+ define i32 @test_use_alias_analysis (ptr %Q ) {
1157+ ; CHECK-LABEL: @test_use_alias_analysis(
1158+ ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[Q:%.*]], align 4
1159+ ; CHECK-NEXT: ret i32 [[A]]
1160+ ;
1161+ %a = load i32 , ptr %Q
1162+ %Q2 = addrspacecast ptr %Q to ptr addrspace (5 )
1163+ store i32 %a , ptr addrspace (5 ) %Q2
1164+ ret i32 %a
1165+ }
You can’t perform that action at this time.
0 commit comments