[PATCH] D67562: [MemorySSA] Update MSSA for non-conventional AA.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 10:33:21 PDT 2019


asbirlea created this revision.
asbirlea added a reviewer: george.burgess.iv.
Herald added subscribers: sanjoy.google, Prazek.
Herald added a project: LLVM.

Regularly when moving an instruction that may not read or write memory,
the instruction is not modelled in MSSA, so not action is necessary.
For a non-conventional AA pipeline, MSSA must be updated with the move.


Repository:
  rL LLVM

https://reviews.llvm.org/D67562

Files:
  lib/Transforms/Utils/LoopRotationUtils.cpp
  test/Analysis/MemorySSA/loop-rotate-disablebasicaa.ll


Index: test/Analysis/MemorySSA/loop-rotate-disablebasicaa.ll
===================================================================
--- /dev/null
+++ test/Analysis/MemorySSA/loop-rotate-disablebasicaa.ll
@@ -0,0 +1,23 @@
+; RUN: opt -disable-basicaa -loop-rotate -enable-mssa-loop-dependency -verify-memoryssa -S < %s | FileCheck %s
+; REQUIRES: asserts
+
+; CHECK-LABEL: @main
+define  void @main() {
+entry:
+  br label %for.cond120
+
+for.cond120:                                      ; preds = %for.body127, %entry
+  call void @foo()
+  br i1 undef, label %for.body127, label %for.cond.cleanup126
+
+for.cond.cleanup126:                              ; preds = %for.cond120
+  unreachable
+
+for.body127:                                      ; preds = %for.cond120
+  %0 = load i16**, i16*** undef, align 1
+  br label %for.cond120
+}
+
+declare void @foo() readnone
+
+
Index: lib/Transforms/Utils/LoopRotationUtils.cpp
===================================================================
--- lib/Transforms/Utils/LoopRotationUtils.cpp
+++ lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -334,6 +334,10 @@
         !Inst->mayWriteToMemory() && !Inst->isTerminator() &&
         !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
       Inst->moveBefore(LoopEntryBranch);
+      if (MSSAU)
+        if (MemoryUseOrDef *MUD = cast_or_null<MemoryUseOrDef>(
+                MSSAU->getMemorySSA()->getMemoryAccess(Inst)))
+          MSSAU->moveToPlace(MUD, OrigPreheader, MemorySSA::End);
       continue;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67562.220137.patch
Type: text/x-patch
Size: 1517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/2c18f8dc/attachment.bin>


More information about the llvm-commits mailing list