[PATCH] D31865: MemorySSA: Make lifetime starts defs for mustaliased pointers

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:07:21 PDT 2017


dberlin created this revision.
Herald added a subscriber: Prazek.

While we don't want them aliasing with other pointers, there seems to
be no point in not having them clobber must-aliased'd pointers.

If some day, we split the aliasing and ordering chains, we'd make this
not aliasing but an ordering barrier (IE it doesn't affect it's
memory, but we can't hoist it above it).


https://reviews.llvm.org/D31865

Files:
  lib/Transforms/Utils/MemorySSA.cpp
  test/Transforms/Util/MemorySSA/lifetime-simple.ll


Index: test/Transforms/Util/MemorySSA/lifetime-simple.ll
===================================================================
--- test/Transforms/Util/MemorySSA/lifetime-simple.ll
+++ test/Transforms/Util/MemorySSA/lifetime-simple.ll
@@ -9,7 +9,7 @@
 ; CHECK:  1 = MemoryDef(liveOnEntry)
 ; CHECK-NEXT:   call void @llvm.lifetime.start(i64 32, i8* %P)
   call void @llvm.lifetime.start(i64 32, i8* %P)
-; CHECK:  MemoryUse(liveOnEntry)
+; CHECK:  MemoryUse(1)
 ; CHECK-NEXT:   %0 = load i8, i8* %P
   %0 = load i8, i8* %P
 ; CHECK:  2 = MemoryDef(1)
Index: lib/Transforms/Utils/MemorySSA.cpp
===================================================================
--- lib/Transforms/Utils/MemorySSA.cpp
+++ lib/Transforms/Utils/MemorySSA.cpp
@@ -220,6 +220,7 @@
     // markers.
     switch (II->getIntrinsicID()) {
     case Intrinsic::lifetime_start:
+      return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), UseLoc);
     case Intrinsic::lifetime_end:
     case Intrinsic::invariant_start:
     case Intrinsic::invariant_end:
@@ -298,7 +299,6 @@
   Instruction *Inst = MD->getMemoryInst();
   if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
     switch (II->getIntrinsicID()) {
-    case Intrinsic::lifetime_start:
     case Intrinsic::lifetime_end:
       return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), Loc);
     default:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31865.94621.patch
Type: text/x-patch
Size: 1353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/c17fd8b1/attachment.bin>


More information about the llvm-commits mailing list