[PATCH] D134161: [MemorySSA] Reset location size if IsGuaranteedLoopInvariant after phi tranlation
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 19 23:10:23 PDT 2022
StephenFan updated this revision to Diff 461474.
StephenFan added a comment.
Rebase.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134161/new/
https://reviews.llvm.org/D134161
Files:
llvm/include/llvm/Analysis/MemorySSA.h
llvm/test/Analysis/MemorySSA/phi-translation.ll
Index: llvm/test/Analysis/MemorySSA/phi-translation.ll
===================================================================
--- llvm/test/Analysis/MemorySSA/phi-translation.ll
+++ llvm/test/Analysis/MemorySSA/phi-translation.ll
@@ -437,10 +437,10 @@
; CHECK-LABEL: merge:
; CHECK: ; 3 = MemoryPhi({lhs,1},{rhs,2})
; CHECK-NEXT %storemerge2 = phi i32 [ 2, %lhs ], [ 3, %rhs ]
-; TODO: Here the defining access could be liveOnEntry. Since all incoming
-; values of phi node can be phi translated.
-; CHECK: ; MemoryUse(3)
-; CHECK-NEXT: %lv = load i16, i16* %arrayidx, align 2
+; LIMIT: ; MemoryUse(3)
+; LIMIT-NEXT: %lv = load i16, i16* %arrayidx, align 2
+; NOLIMIT: ; MemoryUse(liveOnEntry)
+; NOLIMIT-NEXT: %lv = load i16, i16* %arrayidx, align 2
entry:
br i1 %cmp, label %lhs, label %rhs
Index: llvm/include/llvm/Analysis/MemorySSA.h
===================================================================
--- llvm/include/llvm/Analysis/MemorySSA.h
+++ llvm/include/llvm/Analysis/MemorySSA.h
@@ -1252,7 +1252,9 @@
// to unknown guarantees that any memory accesses that access locations
// after the pointer are considered as clobbers, which is important to
// catch loop carried dependences.
- if (!IsGuaranteedLoopInvariant(Location.Ptr))
+ bool GuaranteedLoopInvariant =
+ IsGuaranteedLoopInvariant(Location.Ptr);
+ if (!GuaranteedLoopInvariant)
CurrentPair.second =
Location.getWithNewSize(LocationSize::beforeOrAfterPointer());
PHITransAddr Translator(
@@ -1266,6 +1268,10 @@
if (TransAddr != Location.Ptr) {
CurrentPair.second = CurrentPair.second.getWithNewPtr(TransAddr);
+ if (!GuaranteedLoopInvariant && IsGuaranteedLoopInvariant(TransAddr))
+ CurrentPair.second =
+ CurrentPair.second.getWithNewSize(Location.Size);
+
if (TransAddr &&
!IsGuaranteedLoopInvariant(TransAddr))
CurrentPair.second = CurrentPair.second.getWithNewSize(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134161.461474.patch
Type: text/x-patch
Size: 2045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/fdaf0bbc/attachment.bin>
More information about the llvm-commits
mailing list