[llvm] d3d7603 - [MemorySSA] Report unoptimized as None, not MayAlias.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 23:59:28 PDT 2020
Author: Alina Sbirlea
Date: 2020-09-15T23:58:53-07:00
New Revision: d3d76039002cd879f7aba37f88fc7312cfc95531
URL: https://github.com/llvm/llvm-project/commit/d3d76039002cd879f7aba37f88fc7312cfc95531
DIFF: https://github.com/llvm/llvm-project/commit/d3d76039002cd879f7aba37f88fc7312cfc95531.diff
LOG: [MemorySSA] Report unoptimized as None, not MayAlias.
Added:
Modified:
llvm/include/llvm/Analysis/MemorySSA.h
llvm/test/Analysis/MemorySSA/optimize-use.ll
llvm/test/Analysis/MemorySSA/phi-translation.ll
llvm/test/Analysis/MemorySSA/pr43427.ll
llvm/unittests/Analysis/MemorySSATest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index ffd4b0259327..0be2933dd323 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -270,7 +270,7 @@ class MemoryUseOrDef : public MemoryAccess {
// Retrieve AliasResult type of the optimized access. Ideally this would be
// returned by the caching walker and may go away in the future.
Optional<AliasResult> getOptimizedAccessType() const {
- return OptimizedAccessAlias;
+ return isOptimized() ? OptimizedAccessAlias : None;
}
/// Reset the ID of what this MemoryUse was optimized to, causing it to
diff --git a/llvm/test/Analysis/MemorySSA/optimize-use.ll b/llvm/test/Analysis/MemorySSA/optimize-use.ll
index ec0d5c3df1a3..38ec971dbf53 100644
--- a/llvm/test/Analysis/MemorySSA/optimize-use.ll
+++ b/llvm/test/Analysis/MemorySSA/optimize-use.ll
@@ -22,22 +22,22 @@ entry:
store i32 7, i32* %1, align 4
; NOLIMIT: MemoryUse(3) MustAlias
; NOLIMIT-NEXT: %2 = load i32, i32* %0, align 4
-; LIMIT: MemoryUse(4) MayAlias
+; LIMIT: MemoryUse(4)
; LIMIT-NEXT: %2 = load i32, i32* %0, align 4
%2 = load i32, i32* %0, align 4
; NOLIMIT: MemoryUse(4) MustAlias
; NOLIMIT-NEXT: %3 = load i32, i32* %1, align 4
-; LIMIT: MemoryUse(4) MayAlias
+; LIMIT: MemoryUse(4)
; LIMIT-NEXT: %3 = load i32, i32* %1, align 4
%3 = load i32, i32* %1, align 4
; NOLIMIT: MemoryUse(3) MustAlias
; NOLIMIT-NEXT: %4 = load i32, i32* %0, align 4
-; LIMIT: MemoryUse(4) MayAlias
+; LIMIT: MemoryUse(4)
; LIMIT-NEXT: %4 = load i32, i32* %0, align 4
%4 = load i32, i32* %0, align 4
; NOLIMIT: MemoryUse(4) MustAlias
; NOLIMIT-NEXT: %5 = load i32, i32* %1, align 4
-; LIMIT: MemoryUse(4) MayAlias
+; LIMIT: MemoryUse(4)
; LIMIT-NEXT: %5 = load i32, i32* %1, align 4
%5 = load i32, i32* %1, align 4
%add = add nsw i32 %3, %5
diff --git a/llvm/test/Analysis/MemorySSA/phi-translation.ll b/llvm/test/Analysis/MemorySSA/phi-translation.ll
index 5b5516d8bf76..7fa6e6c69057 100644
--- a/llvm/test/Analysis/MemorySSA/phi-translation.ll
+++ b/llvm/test/Analysis/MemorySSA/phi-translation.ll
@@ -25,7 +25,7 @@ if.end:
; CHECK: 3 = MemoryPhi({entry,1},{if.then,2})
; NOLIMIT: MemoryUse(1) MayAlias
; NOLIMIT-NEXT: load i8, i8* %local, align 1
-; LIMIT: MemoryUse(3) MayAlias
+; LIMIT: MemoryUse(3)
; LIMIT-NEXT: load i8, i8* %local, align 1
load i8, i8* %local, align 1
ret void
@@ -68,7 +68,7 @@ phi.1:
; CHECK: 6 = MemoryPhi({phi.2,4},{phi.3,3})
; NOLIMIT: MemoryUse(1) MayAlias
; NOLIMIT-NEXT: load i8, i8* %local
-; LIMIT: MemoryUse(6) MayAlias
+; LIMIT: MemoryUse(6)
; LIMIT-NEXT: load i8, i8* %local
load i8, i8* %local
ret void
@@ -81,7 +81,7 @@ define void @cross_phi(i8* noalias %p1, i8* noalias %p2) {
store i8 0, i8* %p1
; NOLIMIT: MemoryUse(1) MustAlias
; NOLIMIT-NEXT: load i8, i8* %p1
-; LIMIT: MemoryUse(1) MayAlias
+; LIMIT: MemoryUse(1)
; LIMIT-NEXT: load i8, i8* %p1
load i8, i8* %p1
br i1 undef, label %a, label %b
@@ -116,7 +116,7 @@ e:
; 8 = MemoryPhi({c,4},{d,5})
; NOLIMIT: MemoryUse(1) MustAlias
; NOLIMIT-NEXT: load i8, i8* %p1
-; LIMIT: MemoryUse(8) MayAlias
+; LIMIT: MemoryUse(8)
; LIMIT-NEXT: load i8, i8* %p1
load i8, i8* %p1
ret void
@@ -150,7 +150,7 @@ loop.3:
store i8 2, i8* %p2
; NOLIMIT: MemoryUse(1) MayAlias
; NOLIMIT-NEXT: load i8, i8* %p1
-; LIMIT: MemoryUse(4) MayAlias
+; LIMIT: MemoryUse(4)
; LIMIT-NEXT: load i8, i8* %p1
load i8, i8* %p1
br i1 undef, label %loop.2, label %loop.1
@@ -179,7 +179,7 @@ if.then2:
if.end:
; CHECK: 4 = MemoryPhi({while.cond,5},{if.then,1},{if.then2,2})
-; CHECK: MemoryUse(4) MayAlias
+; CHECK: MemoryUse(4)
; CHECK-NEXT: load i8, i8* %p1
load i8, i8* %p1
; CHECK: 3 = MemoryDef(4)
@@ -187,7 +187,7 @@ if.end:
store i8 2, i8* %p2
; NOLIMIT: MemoryUse(4) MayAlias
; NOLIMIT-NEXT: load i8, i8* %p1
-; LIMIT: MemoryUse(3) MayAlias
+; LIMIT: MemoryUse(3)
; LIMIT-NEXT: load i8, i8* %p1
load i8, i8* %p1
br label %while.cond
@@ -212,11 +212,11 @@ for.body: ; preds = %entry, %for.inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp1 = icmp eq i64 %indvars.iv, 0
%arrayidx2 = getelementptr inbounds i32, i32* %m_i_strides, i64 %indvars.iv
-; CHECK: MemoryUse(4) MayAlias
+; CHECK: MemoryUse(4)
; CHECK-NEXT: %0 = load i32, i32* %arrayidx2, align 4
%0 = load i32, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds i32, i32* %eval_left_dims, i64 %indvars.iv
-; CHECK: MemoryUse(4) MayAlias
+; CHECK: MemoryUse(4)
; CHECK-NEXT: %1 = load i32, i32* %arrayidx4, align 4
%1 = load i32, i32* %arrayidx4, align 4
%mul = mul nsw i32 %1, %0
@@ -270,7 +270,7 @@ for.main.body: ; preds = %if.end220.if.then185_crit_edge, %for.bod
%add199 = add nuw nsw i64 %nocontract_idx.0656, 1
%cmp200 = icmp eq i64 %nocontract_idx.0656, 0
%arrayidx.i559 = getelementptr inbounds %BigStruct, %BigStruct* %this, i64 0, i32 7, i32 0, i64 %nocontract_idx.0656
-; CHECK: MemoryUse(4) MayAlias
+; CHECK: MemoryUse(4)
; CHECK-NEXT: %tmp21 = load i64, i64* %arrayidx.i559, align 8
%tmp21 = load i64, i64* %arrayidx.i559, align 8
%mul206 = mul nsw i64 %tmp21, %tmp21
@@ -298,7 +298,7 @@ define i32 @dont_merge_noalias_simple(i32* noalias %ptr) {
; CHECK-NEXT: store i16 1, i16* %s1.ptr, align 2
; CHECK-LABEL: %for.body
-; CHECK: ; MemoryUse(4) MayAlias
+; CHECK: ; MemoryUse(4)
; CHECK-NEXT: %lv = load i16, i16* %arrayidx, align 2
entry:
@@ -331,7 +331,7 @@ define i32 @dont_merge_noalias_complex(i32* noalias %ptr, i32* noalias %another)
; CHECK-NEXT: store i16 1, i16* %s1.ptr, align 2
; CHECK-LABEL: %for.body
-; CHECK: ; MemoryUse(7) MayAlias
+; CHECK: ; MemoryUse(7)
; CHECK-NEXT: %lv = load i16, i16* %arrayidx, align 2
entry:
@@ -385,7 +385,7 @@ define void @dont_merge_noalias_complex_2(i32 %arg, i32 %arg1) {
; CHECK-LABEL: loop.1.header:
; CHECK-NEXT: ; 4 = MemoryPhi({entry,1},{loop.1.latch,3})
-; CHECK: ; MemoryUse(4) MayAlias
+; CHECK: ; MemoryUse(4)
; CHECK-NEXT: %l.1 = load i32, i32* %p.1, align 4
; CHECK-LABEL: loop.1.latch:
@@ -394,7 +394,7 @@ define void @dont_merge_noalias_complex_2(i32 %arg, i32 %arg1) {
; CHECK-LABEL: storebb:
; CHECK-NEXT: %iv.add2 = add nuw nsw i64 %iv, 2
; CHECK-NEXT: %p.2 = getelementptr inbounds [32 x i32], [32 x i32]* %tmp, i64 0, i64 %iv.add2
-; CHECK-NEXT: ; MemoryUse(4) MayAlias
+; CHECK-NEXT: ; MemoryUse(4)
; CHECK-NEXT: %l.2 = load i32, i32* %p.2, align 4
; CHECK-NEXT: ; 2 = MemoryDef(4)
; CHECK-NEXT: store i32 10, i32* %p.1, align 4
@@ -445,7 +445,7 @@ while.cond: ; preds = %entry, %while.cond.
; CHECK-LABEL: land.rhs:
; CHECK-NEXT: %sub = add nsw i32 %depth.1, -1
; CHECK-NEXT: %arrayidx = getelementptr inbounds [12 x i32], [12 x i32]* %nodeStack, i32 0, i32 %sub
-; CHECK-NEXT: ; MemoryUse([[NO6]]) MayAlias
+; CHECK-NEXT: ; MemoryUse([[NO6]])
; CHECK-NEXT: %1 = load i32, i32* %arrayidx, align 4
land.rhs: ; preds = %while.cond
diff --git a/llvm/test/Analysis/MemorySSA/pr43427.ll b/llvm/test/Analysis/MemorySSA/pr43427.ll
index 3cb571505f73..00a015c98e8f 100644
--- a/llvm/test/Analysis/MemorySSA/pr43427.ll
+++ b/llvm/test/Analysis/MemorySSA/pr43427.ll
@@ -20,7 +20,7 @@
; CHECK-NEXT: [[NO7]] = MemoryPhi({lbl2,[[NO8]]},{for.end,2})
; CHECK: cleanup:
-; CHECK-NEXT: MemoryUse([[NO7]]) MayAlias
+; CHECK-NEXT: MemoryUse([[NO7]])
; CHECK-NEXT: %cleanup.dest = load i32, i32* undef, align 1
; CHECK: lbl1.backedge:
diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp
index b470f1626126..5c0c48b78831 100644
--- a/llvm/unittests/Analysis/MemorySSATest.cpp
+++ b/llvm/unittests/Analysis/MemorySSATest.cpp
@@ -1066,7 +1066,7 @@ TEST_F(MemorySSATest, TestStoreMustAlias) {
MemoryDef *MemDef = dyn_cast_or_null<MemoryDef>(MSSA.getMemoryAccess(V));
EXPECT_EQ(MemDef->isOptimized(), false)
<< "Store " << I << " is optimized from the start?";
- EXPECT_EQ(MemDef->getOptimizedAccessType(), MayAlias)
+ EXPECT_EQ(MemDef->getOptimizedAccessType(), None)
<< "Store " << I
<< " has correct alias information before being optimized?";
if (V == SA1)
@@ -1170,7 +1170,7 @@ TEST_F(MemorySSATest, TestStoreMayAlias) {
MemoryDef *MemDef = dyn_cast_or_null<MemoryDef>(MSSA.getMemoryAccess(V));
EXPECT_EQ(MemDef->isOptimized(), false)
<< "Store " << I << " is optimized from the start?";
- EXPECT_EQ(MemDef->getOptimizedAccessType(), MayAlias)
+ EXPECT_EQ(MemDef->getOptimizedAccessType(), None)
<< "Store " << I
<< " has correct alias information before being optimized?";
++I;
More information about the llvm-commits
mailing list