[llvm] r372932 - [MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 16:24:39 PDT 2019


Author: asbirlea
Date: Wed Sep 25 16:24:39 2019
New Revision: 372932

URL: http://llvm.org/viewvc/llvm-project?rev=372932&view=rev
Log:
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Summary:
If a block has all incoming values with the same MemoryAccess (ignoring
incoming values from unreachable blocks), then use that incoming
MemoryAccess and do not create a Phi in the first place.

Revert IDF work-around added in rL372673; it should not be required unless
the Def inserted is the first in its block.

The patch also cleans up a series of tests, added during the many
iterations on insertDef.

The patch also fixes PR43438.
The same issue that occurs in insertDef with "adding phis, hence the IDF of
Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive`
call only adds Phis walking on the predecessor edges, which means there
may be the case of a Phi added walking the CFG "backwards" which
triggers the needs for an additional Phi in successor blocks.
Such Phis are added during fixupDefs only in the presence of unreachable
blocks.
Hence this highlights the need to avoid adding Phis in blocks with
unreachable predecessors in the first place.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67995

Added:
    llvm/trunk/test/Analysis/MemorySSA/pr42940.ll
      - copied, changed from r372915, llvm/trunk/test/Analysis/MemorySSA/PR42940.ll
    llvm/trunk/test/Analysis/MemorySSA/pr43044.ll
      - copied, changed from r372915, llvm/trunk/test/Analysis/MemorySSA/PR43044.ll
    llvm/trunk/test/Analysis/MemorySSA/pr43438.ll
Removed:
    llvm/trunk/test/Analysis/MemorySSA/PR42940.ll
    llvm/trunk/test/Analysis/MemorySSA/PR43044.ll
Modified:
    llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp
    llvm/trunk/test/Analysis/MemorySSA/pr40754.ll
    llvm/trunk/test/Analysis/MemorySSA/pr41640.ll
    llvm/trunk/test/Analysis/MemorySSA/pr43317.ll

Modified: llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp?rev=372932&r1=372931&r2=372932&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp (original)
+++ llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp Wed Sep 25 16:24:39 2019
@@ -71,11 +71,19 @@ MemoryAccess *MemorySSAUpdater::getPrevi
     // Recurse to get the values in our predecessors for placement of a
     // potential phi node. This will insert phi nodes if we cycle in order to
     // break the cycle and have an operand.
-    for (auto *Pred : predecessors(BB))
-      if (MSSA->DT->isReachableFromEntry(Pred))
-        PhiOps.push_back(getPreviousDefFromEnd(Pred, CachedPreviousDef));
-      else
+    bool UniqueIncomingAccess = true;
+    MemoryAccess *SingleAccess = nullptr;
+    for (auto *Pred : predecessors(BB)) {
+      if (MSSA->DT->isReachableFromEntry(Pred)) {
+        auto *IncomingAccess = getPreviousDefFromEnd(Pred, CachedPreviousDef);
+        if (!SingleAccess)
+          SingleAccess = IncomingAccess;
+        else if (IncomingAccess != SingleAccess)
+          UniqueIncomingAccess = false;
+        PhiOps.push_back(IncomingAccess);
+      } else
         PhiOps.push_back(MSSA->getLiveOnEntryDef());
+    }
 
     // Now try to simplify the ops to avoid placing a phi.
     // This may return null if we never created a phi yet, that's okay
@@ -84,7 +92,9 @@ MemoryAccess *MemorySSAUpdater::getPrevi
     // See if we can avoid the phi by simplifying it.
     auto *Result = tryRemoveTrivialPhi(Phi, PhiOps);
     // If we couldn't simplify, we may have to create a phi
-    if (Result == Phi) {
+    if (Result == Phi && UniqueIncomingAccess && SingleAccess)
+      Result = SingleAccess;
+    else if (Result == Phi && !(UniqueIncomingAccess && SingleAccess)) {
       if (!Phi)
         Phi = MSSA->createMemoryPhi(BB);
 
@@ -315,8 +325,8 @@ void MemorySSAUpdater::insertDef(MemoryD
 
   SmallVector<WeakVH, 8> FixupList(InsertedPHIs.begin(), InsertedPHIs.end());
 
-  SmallPtrSet<BasicBlock *, 2> DefiningBlocks;
-
+  // Remember the index where we may insert new phis.
+  unsigned NewPhiIndex = InsertedPHIs.size();
   if (!DefBeforeSameBlock) {
     // If there was a local def before us, we must have the same effect it
     // did. Because every may-def is the same, any phis/etc we would create, it
@@ -335,49 +345,51 @@ void MemorySSAUpdater::insertDef(MemoryD
     auto Iter = MD->getDefsIterator();
     ++Iter;
     auto IterEnd = MSSA->getBlockDefs(MD->getBlock())->end();
-    if (Iter == IterEnd)
+    if (Iter == IterEnd) {
+      SmallPtrSet<BasicBlock *, 2> DefiningBlocks;
       DefiningBlocks.insert(MD->getBlock());
+      for (const auto &VH : InsertedPHIs)
+        if (const auto *RealPHI = cast_or_null<MemoryPhi>(VH))
+          DefiningBlocks.insert(RealPHI->getBlock());
+      ForwardIDFCalculator IDFs(*MSSA->DT);
+      SmallVector<BasicBlock *, 32> IDFBlocks;
+      IDFs.setDefiningBlocks(DefiningBlocks);
+      IDFs.calculate(IDFBlocks);
+      SmallVector<AssertingVH<MemoryPhi>, 4> NewInsertedPHIs;
+      for (auto *BBIDF : IDFBlocks) {
+        auto *MPhi = MSSA->getMemoryAccess(BBIDF);
+        if (!MPhi) {
+          MPhi = MSSA->createMemoryPhi(BBIDF);
+          NewInsertedPHIs.push_back(MPhi);
+        }
+        // Add the phis created into the IDF blocks to NonOptPhis, so they are
+        // not optimized out as trivial by the call to getPreviousDefFromEnd
+        // below. Once they are complete, all these Phis are added to the
+        // FixupList, and removed from NonOptPhis inside fixupDefs(). Existing
+        // Phis in IDF may need fixing as well, and potentially be trivial
+        // before this insertion, hence add all IDF Phis. See PR43044.
+        NonOptPhis.insert(MPhi);
+      }
+      for (auto &MPhi : NewInsertedPHIs) {
+        auto *BBIDF = MPhi->getBlock();
+        for (auto *Pred : predecessors(BBIDF)) {
+          DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> CachedPreviousDef;
+          MPhi->addIncoming(getPreviousDefFromEnd(Pred, CachedPreviousDef),
+                            Pred);
+        }
+      }
 
-    FixupList.push_back(MD);
-  }
-
-  ForwardIDFCalculator IDFs(*MSSA->DT);
-  SmallVector<BasicBlock *, 32> IDFBlocks;
-  for (const auto &VH : InsertedPHIs)
-    if (const auto *RealPHI = cast_or_null<MemoryPhi>(VH))
-      DefiningBlocks.insert(RealPHI->getBlock());
-  IDFs.setDefiningBlocks(DefiningBlocks);
-  IDFs.calculate(IDFBlocks);
-  SmallVector<AssertingVH<MemoryPhi>, 4> NewInsertedPHIs;
-  for (auto *BBIDF : IDFBlocks) {
-    auto *MPhi = MSSA->getMemoryAccess(BBIDF);
-    if (!MPhi) {
-      MPhi = MSSA->createMemoryPhi(BBIDF);
-      NewInsertedPHIs.push_back(MPhi);
-    }
-    // Add the phis created into the IDF blocks to NonOptPhis, so they are not
-    // optimized out as trivial by the call to getPreviousDefFromEnd below. Once
-    // they are complete, all these Phis are added to the FixupList, and removed
-    // from NonOptPhis inside fixupDefs(). Existing Phis in IDF may need fixing
-    // as well, and potentially be trivial before this insertion, hence add all
-    // IDF Phis. See PR43044.
-    NonOptPhis.insert(MPhi);
-  }
-
-  for (auto &MPhi : NewInsertedPHIs) {
-    auto *BBIDF = MPhi->getBlock();
-    for (auto *Pred : predecessors(BBIDF)) {
-      DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> CachedPreviousDef;
-      MPhi->addIncoming(getPreviousDefFromEnd(Pred, CachedPreviousDef), Pred);
+      // Re-take the index where we're adding the new phis, because the above
+      // call to getPreviousDefFromEnd, may have inserted into InsertedPHIs.
+      NewPhiIndex = InsertedPHIs.size();
+      for (auto &MPhi : NewInsertedPHIs) {
+        InsertedPHIs.push_back(&*MPhi);
+        FixupList.push_back(&*MPhi);
+      }
     }
+    FixupList.push_back(MD);
   }
 
-  // Remember the index where we may insert new phis.
-  unsigned NewPhiIndex = InsertedPHIs.size();
-  for (auto &MPhi : NewInsertedPHIs) {
-    InsertedPHIs.push_back(&*MPhi);
-    FixupList.push_back(&*MPhi);
-  }
   // Remember the index where we stopped inserting new phis above, since the
   // fixupDefs call in the loop below may insert more, that are already minimal.
   unsigned NewPhiIndexEnd = InsertedPHIs.size();

Removed: llvm/trunk/test/Analysis/MemorySSA/PR42940.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/PR42940.ll?rev=372931&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/PR42940.ll (original)
+++ llvm/trunk/test/Analysis/MemorySSA/PR42940.ll (removed)
@@ -1,189 +0,0 @@
-; RUN: opt -licm -enable-mssa-loop-dependency -verify-memoryssa  -S %s | FileCheck %s
-; REQUIRES: asserts
-
-target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
-target triple = "s390x-ibm-linux"
-
- at g_77 = external dso_local global i16, align 2
-
-; CHECK-LABEL: @f1()
-define void @f1() {
-entry:
-  store i16 undef, i16* @g_77, align 2
-  br label %loop_pre
-
-unreachablelabel: ; No predecessors
-  br label %loop_pre
-
-loop_pre:
-  br label %for.cond.header
-
-for.cond.header:
-  store i32 0, i32* undef, align 4
-  br i1 undef, label %for.body, label %for.end
-
-for.body:
-  %tmp1 = load volatile i16, i16* undef, align 2
-  br label %for.end
-
-for.end:
-  br i1 undef, label %func.exit, label %for.cond.header
-
-func.exit:
-  ret void
-}
-
- at g_159 = external dso_local global i32, align 4
-
-; CHECK-LABEL: @f2()
-define void @f2() {
-entry:
-  br label %for.header.first
-
-for.header.first:
-  br label %for.body.first
-
-for.body.first:
-  store i32 0, i32* @g_159, align 4
-  br i1 undef, label %for.body.first, label %for.end.first
-
-for.end.first:
-  br i1 undef, label %lor.end, label %for.header.first
-
-lor.end:
-  br label %for.pre
-
-unreachablelabel: ; No predecessors
-  br label %for.pre
-
-for.pre:
-  br label %for.header.second
-
-for.header.second:
-  store i32 undef, i32* undef, align 4
-  br label %for.header.second
-}
-
- at g_271 = external dso_local global i8, align 2
- at g_427 = external dso_local unnamed_addr global [9 x i16], align 2
-
-; CHECK-LABEL: @f3()
-define  void @f3() {
-entry:
-  br label %for.preheader
-
-for.preheader:
-  store volatile i8 undef, i8* @g_271, align 2
-  br i1 undef, label %for.preheader, label %for.end
-
-for.end:
-  br label %lbl_1058.i
-
-unreachablelabel: ; No predecessors
-  br label %lbl_1058.i
-
-lbl_1058.i:
-  br label %for.cond3.preheader.i
-
-for.cond3.preheader.i:
-  %tmp1 = load i16, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @g_427, i64 0, i64 2), align 2
-  %conv620.i129 = zext i16 %tmp1 to i32
-  %cmp621.i130 = icmp ugt i32 undef, %conv620.i129
-  %conv622.i131 = zext i1 %cmp621.i130 to i32
-  store i32 %conv622.i131, i32* undef, align 4
-  br i1 undef, label %func.exit, label %for.cond3.preheader.i
-
-func.exit:
-  ret void
-}
-
- at g_6 = external dso_local unnamed_addr global [3 x i32], align 4
- at g_244 = external dso_local global i64, align 8
- at g_1164 = external dso_local global i64, align 8
-
-; CHECK-LABEL: @f4()
-define void @f4() {
-entry:
-  br label %for.cond8.preheader
-
-for.cond8.preheader:
-  store i32 0, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @g_6, i64 0, i64 2), align 4
-  br i1 undef, label %if.end, label %for.cond8.preheader
-
-if.end:
-  br i1 undef, label %cleanup1270, label %for.cond504.preheader
-
-for.cond504.preheader:
-  store i64 undef, i64* @g_244, align 8
-  br label %cleanup1270
-
-for.cond559.preheader:
-  store i64 undef, i64* @g_1164, align 8
-  br i1 undef, label %for.cond559.preheader, label %cleanup1270
-
-cleanup1270:
-  ret void
-}
-
- at g_1504 = external dso_local local_unnamed_addr global i16****, align 8
-
-define void @f5() {
-bb:
-  tail call fastcc void @f21()
-  br label %bb12.outer
-
-bb12.outer.loopexit:                              ; No predecessors!
-  br label %bb12.outer
-
-bb12.outer:                                       ; preds = %bb12.outer.loopexit, %bb
-  br i1 undef, label %bb12.outer.split.us, label %bb12.preheader
-
-bb12.preheader:                                   ; preds = %bb12.outer
-  br label %bb12
-
-bb12.outer.split.us:                              ; preds = %bb12.outer
-  br label %bb16.us.us
-
-bb16.us.us:                                       ; preds = %bb16.us.us, %bb12.outer.split.us
-  br label %bb16.us.us
-
-bb12:                                             ; preds = %bb77.1, %bb12.preheader
-  br i1 undef, label %bb25.preheader, label %bb77
-
-bb25.preheader:                                   ; preds = %bb12.1, %bb12
-  br label %bb25
-
-bb25:                                             ; preds = %l0, %bb25.preheader
-  br i1 undef, label %bb62, label %bb71.thread
-
-bb62:                                             ; preds = %bb25
-  br i1 undef, label %bb92.loopexit, label %l0
-
-l0:                                                ; preds = %bb62
-  br label %bb25
-
-bb71.thread:                                      ; preds = %bb25
-  br label %bb92
-
-bb77:                                             ; preds = %bb12
-  %tmp78 = load i16****, i16***** @g_1504, align 8
-  %tmp79 = load volatile i16***, i16**** %tmp78, align 8
-  br i1 undef, label %bb91, label %bb12.1
-
-bb91:                                             ; preds = %bb77.1, %bb77
-  unreachable
-
-bb92.loopexit:                                    ; preds = %bb62
-  br label %bb92
-
-bb92:                                             ; preds = %bb92.loopexit, %bb71.thread
-  ret void
-
-bb12.1:                                           ; preds = %bb77
-  br i1 undef, label %bb25.preheader, label %bb77.1
-
-bb77.1:                                           ; preds = %bb12.1
-  br i1 undef, label %bb91, label %bb12
-}
-
-declare void @f21()

Removed: llvm/trunk/test/Analysis/MemorySSA/PR43044.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/PR43044.ll?rev=372931&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/PR43044.ll (original)
+++ llvm/trunk/test/Analysis/MemorySSA/PR43044.ll (removed)
@@ -1,52 +0,0 @@
-; RUN: opt -loop-rotate -licm -enable-mssa-loop-dependency -verify-memoryssa %s -S | FileCheck %s
-; REQUIRES: asserts
-
-target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
-target triple = "s390x-ibm-linux"
-
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
-
-; CHECK-LABEL: @func_42()
-define void @func_42() {
-entry:
-  br label %for.cond1050
-
-for.cond1050.loopexit:                            ; preds = %for.cond1373
-  br label %for.cond1050
-
-for.cond1050:                                     ; preds = %for.cond1050.loopexit, %entry
-  %storemerge6 = phi i32 [ 2, %entry ], [ 0, %for.cond1050.loopexit ]
-  %cmp1051 = icmp sgt i32 %storemerge6, -1
-  br i1 %cmp1051, label %for.cond1055.preheader, label %cleanup1400.loopexit1
-
-for.cond1055.preheader:                           ; preds = %for.cond1050
-  store i64 0, i64* null, align 8
-  %0 = load i64, i64* null, align 8
-  %tobool1383 = icmp eq i64 %0, 0
-  br i1 %tobool1383, label %for.cond1055.preheader.cleanup1400.loopexit.split_crit_edge, label %for.cond1055.preheader.for.cond1055.preheader.split_crit_edge
-
-for.cond1055.preheader.for.cond1055.preheader.split_crit_edge: ; preds = %for.cond1055.preheader
-  br label %for.body1376
-
-for.cond1055.preheader.cleanup1400.loopexit.split_crit_edge: ; preds = %for.cond1055.preheader
-  br label %cleanup1400.loopexit.split
-
-for.cond1373:                                     ; preds = %for.body1376
-  br i1 true, label %for.body1376, label %for.cond1050.loopexit
-
-for.body1376:                                     ; preds = %for.cond1373, %for.cond1055.preheader.for.cond1055.preheader.split_crit_edge
-  br i1 false, label %cleanup1400.loopexit, label %for.cond1373
-
-cleanup1400.loopexit:                             ; preds = %for.body1376
-  br label %cleanup1400.loopexit.split
-
-cleanup1400.loopexit.split:                       ; preds = %cleanup1400.loopexit, %for.cond1055.preheader.cleanup1400.loopexit.split_crit_edge
-  br label %cleanup1400
-
-cleanup1400.loopexit1:                            ; preds = %for.cond1050
-  br label %cleanup1400
-
-cleanup1400:                                      ; preds = %cleanup1400.loopexit1, %cleanup1400.loopexit.split
-  call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull undef)
-  unreachable
-}

Modified: llvm/trunk/test/Analysis/MemorySSA/pr40754.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr40754.ll?rev=372932&r1=372931&r2=372932&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/pr40754.ll (original)
+++ llvm/trunk/test/Analysis/MemorySSA/pr40754.ll Wed Sep 25 16:24:39 2019
@@ -11,44 +11,45 @@ target triple = "systemz-unknown"
 ; Function Attrs: norecurse noreturn nounwind
 define dso_local void @func_65() local_unnamed_addr {
 ; CHECK-LABEL: @func_65()
-  br label %1
+label0:
+  br label %label1
 
-; <label>:1:                                      ; preds = %.thread, %0
-  br label %2
+label1:                                      ; preds = %.thread, %label0
+  br label %label2
 
-; <label>:2:                                      ; preds = %.critedge, %1
-  br label %3
+label2:                                      ; preds = %.critedge, %label1
+  br label %label3
 
-; <label>:3:                                      ; preds = %5, %2
-  %storemerge = phi i32 [ 0, %2 ], [ %6, %5 ]
+label3:                                      ; preds = %label5, %label2
+  %storemerge = phi i32 [ 0, %label2 ], [ %tmp6, %label5 ]
   store i32 %storemerge, i32* @g_185, align 4
-  %4 = icmp ult i32 %storemerge, 2
-  br i1 %4, label %5, label %.thread.loopexit
+  %tmp4 = icmp ult i32 %storemerge, 2
+  br i1 %tmp4, label %label5, label %.thread.loopexit
 
-; <label>:5:                                      ; preds = %3
-  %6 = add i32 %storemerge, 1
-  %7 = zext i32 %6 to i64
-  %8 = getelementptr [8 x [4 x [6 x i32]]], [8 x [4 x [6 x i32]]]* @g_120, i64 0, i64 undef, i64 %7, i64 undef
-  %9 = load i32, i32* %8, align 4
-  %10 = icmp eq i32 %9, 0
-  br i1 %10, label %3, label %11
-
-; <label>:11:                                     ; preds = %5
-  %storemerge.lcssa4 = phi i32 [ %storemerge, %5 ]
-  %12 = icmp eq i32 %storemerge.lcssa4, 0
-  br i1 %12, label %.critedge, label %.thread.loopexit3
+label5:                                      ; preds = %label3
+  %tmp6 = add i32 %storemerge, 1
+  %tmp7 = zext i32 %tmp6 to i64
+  %tmp8 = getelementptr [8 x [4 x [6 x i32]]], [8 x [4 x [6 x i32]]]* @g_120, i64 0, i64 undef, i64 %tmp7, i64 undef
+  %tmp9 = load i32, i32* %tmp8, align 4
+  %tmp10 = icmp eq i32 %tmp9, 0
+  br i1 %tmp10, label %label3, label %label11
+
+label11:                                     ; preds = %label5
+  %storemerge.lcssa4 = phi i32 [ %storemerge, %label5 ]
+  %tmp12 = icmp eq i32 %storemerge.lcssa4, 0
+  br i1 %tmp12, label %.critedge, label %.thread.loopexit3
 
-.critedge:                                        ; preds = %11
+.critedge:                                        ; preds = %label11
   store i16 0, i16* @g_329, align 2
-  br label %2
+  br label %label2
 
-.thread.loopexit:                                 ; preds = %3
+.thread.loopexit:                                 ; preds = %label3
   br label %.thread
 
-.thread.loopexit3:                                ; preds = %11
+.thread.loopexit3:                                ; preds = %label11
   br label %.thread
 
 .thread:                                          ; preds = %.thread.loopexit3, %.thread.loopexit
-  br label %1
+  br label %label1
 }
 

Modified: llvm/trunk/test/Analysis/MemorySSA/pr41640.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr41640.ll?rev=372932&r1=372931&r2=372932&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/pr41640.ll (original)
+++ llvm/trunk/test/Analysis/MemorySSA/pr41640.ll Wed Sep 25 16:24:39 2019
@@ -1,5 +1,4 @@
-; RUN: opt -S -licm -enable-mssa-loop-dependency %s | FileCheck %s
-; REQUIRES: asserts
+; RUN: opt -disable-output -licm -print-memoryssa -enable-mssa-loop-dependency=true < %s 2>&1 | FileCheck %s
 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
 target triple = "s390x-ibm-linux"
 
@@ -8,6 +7,8 @@ target triple = "s390x-ibm-linux"
 @g_1087 = external dso_local global i32**, align 8
 
 ; CHECK-LABEL: @f1()
+; CHECK: 5 = MemoryPhi(
+; CHECK-NOT: 7 = MemoryPhi(
 define dso_local fastcc void @f1() unnamed_addr #0 {
 label0:
   br i1 undef, label %thread-pre-split.i.preheader, label %label5

Copied: llvm/trunk/test/Analysis/MemorySSA/pr42940.ll (from r372915, llvm/trunk/test/Analysis/MemorySSA/PR42940.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr42940.ll?p2=llvm/trunk/test/Analysis/MemorySSA/pr42940.ll&p1=llvm/trunk/test/Analysis/MemorySSA/PR42940.ll&r1=372915&r2=372932&rev=372932&view=diff
==============================================================================
    (empty)

Copied: llvm/trunk/test/Analysis/MemorySSA/pr43044.ll (from r372915, llvm/trunk/test/Analysis/MemorySSA/PR43044.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr43044.ll?p2=llvm/trunk/test/Analysis/MemorySSA/pr43044.ll&p1=llvm/trunk/test/Analysis/MemorySSA/PR43044.ll&r1=372915&r2=372932&rev=372932&view=diff
==============================================================================
    (empty)

Modified: llvm/trunk/test/Analysis/MemorySSA/pr43317.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr43317.ll?rev=372932&r1=372931&r2=372932&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/pr43317.ll (original)
+++ llvm/trunk/test/Analysis/MemorySSA/pr43317.ll Wed Sep 25 16:24:39 2019
@@ -1,10 +1,13 @@
-; RUN: opt -S -licm -enable-mssa-loop-dependency=true < %s | FileCheck %s
-; REQUIRES: asserts
+; RUN: opt -disable-output -licm -print-memoryssa -enable-mssa-loop-dependency=true < %s 2>&1 | FileCheck %s
 @v_274 = external dso_local global i64, align 1
 @v_295 = external dso_local global i16, align 1
 @v_335 = external dso_local global i32, align 1
 
 ; CHECK-LABEL: @main()
+; CHECK-NOT: 5 = MemoryPhi(
+; CHECK-NOT: 6 = MemoryPhi(
+; CHECK: 4 = MemoryPhi(
+; CHECK-NOT: 7 = MemoryPhi(
 define dso_local void @main() {
 entry:
   store i32 undef, i32* @v_335, align 1

Added: llvm/trunk/test/Analysis/MemorySSA/pr43438.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemorySSA/pr43438.ll?rev=372932&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/MemorySSA/pr43438.ll (added)
+++ llvm/trunk/test/Analysis/MemorySSA/pr43438.ll Wed Sep 25 16:24:39 2019
@@ -0,0 +1,46 @@
+; RUN: opt -disable-output -licm -print-memoryssa -enable-mssa-loop-dependency=true < %s 2>&1 | FileCheck %s
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-LABEL: @main()
+; CHECK: 5 = MemoryPhi(
+; CHECK-NOT: 7 = MemoryPhi(
+ at v_67 = external dso_local global i32, align 1
+ at v_76 = external dso_local global i16, align 1
+ at v_86 = external dso_local global i16 *, align 1
+
+define dso_local void @main() {
+entry:
+  %v_59 = alloca i16, align 2
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.body, %entry
+  br i1 undef, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond
+  store i16 undef, i16* %v_59, align 2
+  br label %for.cond
+
+for.end:                                          ; preds = %for.cond
+  br i1 undef, label %if.else568, label %cond.end82
+
+cond.false69:                                     ; No predecessors!
+  br label %cond.end82
+
+cond.end82:                                       ; preds = %cond.false69, %cond.true55
+  br i1 undef, label %if.else568, label %land.lhs.true87
+
+land.lhs.true87:                                  ; preds = %cond.end82
+  br i1 undef, label %if.then88, label %if.else568
+
+if.then88:                                        ; preds = %land.lhs.true87
+  store i16 * @v_76, i16 ** @v_86, align 1
+  br label %if.end569
+
+if.else568:                                       ; preds = %land.lhs.true87, %cond.end82, %for.end
+  store volatile i32 undef, i32 * @v_67, align 1
+  br label %if.end569
+
+if.end569:                                        ; preds = %if.else568, %if.then88
+  ret void
+}
+




More information about the llvm-commits mailing list