[PATCH] D151638: [TRE] icmp does not escape an alloca
Joshua Cao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 28 22:25:21 PDT 2023
caojoshua created this revision.
Herald added subscribers: laytonio, hiraditya.
Herald added a project: All.
caojoshua added reviewers: nikic, efriedma, avl.
Herald added a subscriber: StephenFan.
caojoshua updated this revision to Diff 526367.
caojoshua edited the summary of this revision.
caojoshua added a comment.
Herald added subscribers: kmitropoulou, asbirlea, JDevlieghere.
caojoshua updated this revision to Diff 526380.
caojoshua edited the summary of this revision.
caojoshua published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add details to commit msg
caojoshua added a comment.
edit commit msg
Potentially fixes https://github.com/rust-lang/rust/issues/111603.
Marking tail calls helps MemCpyOptimizer and AliasAnalysis remove a
memcpy.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151638
Files:
llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
llvm/test/Transforms/TailCallElim/basic.ll
Index: llvm/test/Transforms/TailCallElim/basic.ll
===================================================================
--- llvm/test/Transforms/TailCallElim/basic.ll
+++ llvm/test/Transforms/TailCallElim/basic.ll
@@ -245,7 +245,7 @@
; Test that using an alloca in a icmp does not escape it
define void @test16() {
; CHECK-LABEL: @test16
-; CHECK-NOT: tail call void @noarg
+; CHECK: tail call void @noarg
; CHECK-NOT: tail call void @use
entry:
%alloca = alloca [100 x i32]
Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -143,6 +143,7 @@
}
break;
}
+ case Instruction::ICmp:
case Instruction::Load: {
// The result of a load is not alloca-derived (unless an alloca has
// otherwise escaped, but this is a local analysis).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151638.526380.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230529/b94460aa/attachment.bin>
More information about the llvm-commits
mailing list