[PATCH] D134160: [MemorySSA] Add test that all incoming values of phi node could be translated
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 18 23:14:09 PDT 2022
StephenFan created this revision.
StephenFan added reviewers: nikic, asbirlea.
Herald added a subscriber: george.burgess.iv.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134160
Files:
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
@@ -424,6 +424,48 @@
ret void
}
+define i32 @phi_with_constant_values(i32* noalias %ptr, i1 %cmp) {
+; CHECK-LABEL: define i32 @phi_with_constant_values
+; CHECK-LABEL: lhs:
+; CHECK: ; 1 = MemoryDef(liveOnEntry)
+; CHECK-NEXT: store i16 1, i16* %s1.ptr, align 2
+
+; CHECK-LABEL: rhs:
+; CHECK: ; 2 = MemoryDef(liveOnEntry)
+; CHECK-NEXT: store i16 1, i16* %s2.ptr, align 2
+
+; 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
+
+entry:
+ br i1 %cmp, label %lhs, label %rhs
+
+lhs:
+ %s1.ptr = getelementptr inbounds [2 x i16], [2 x i16]* @c, i64 0, i64 0
+ store i16 1, i16* %s1.ptr, align 2
+ br label %merge
+
+rhs:
+ %s2.ptr = getelementptr inbounds [2 x i16], [2 x i16]* @c, i64 0, i64 1
+ store i16 1, i16* %s2.ptr, align 2
+ br label %merge
+
+merge: ; preds = %for.body, %entry
+ %storemerge2 = phi i32 [ 2, %lhs ], [ 3, %rhs ]
+ %idxprom1 = zext i32 %storemerge2 to i64
+ %arrayidx = getelementptr inbounds [2 x i16], [2 x i16]* @c, i64 0, i64 %idxprom1
+ %lv = load i16, i16* %arrayidx, align 2
+ br label %end
+
+end: ; preds = %for.body
+ ret i32 0
+}
+
; CHECK-LABEL: define void @use_clobbered_by_def_in_loop()
define void @use_clobbered_by_def_in_loop() {
entry:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134160.461140.patch
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/4c125877/attachment.bin>
More information about the llvm-commits
mailing list