[llvm] 5499901 - [llvm-reduce] Do not replace lifetime pointer arg with zero/one/poison (#151697)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 00:06:41 PDT 2025
Author: Nikita Popov
Date: 2025-08-04T09:06:38+02:00
New Revision: 549990124d1f71b1cdd0f14228a22738113b2f84
URL: https://github.com/llvm/llvm-project/commit/549990124d1f71b1cdd0f14228a22738113b2f84
DIFF: https://github.com/llvm/llvm-project/commit/549990124d1f71b1cdd0f14228a22738113b2f84.diff
LOG: [llvm-reduce] Do not replace lifetime pointer arg with zero/one/poison (#151697)
The lifetime argument is now required to be an alloca, so we should not
try to replace it with a constant.
We also shouldn't try to change the size argument to zero/one, similar
to how we avoid zero-size allocas.
Added:
Modified:
llvm/test/tools/llvm-reduce/reduce-operands-alloca.ll
llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-reduce/reduce-operands-alloca.ll b/llvm/test/tools/llvm-reduce/reduce-operands-alloca.ll
index 61c46185b3378..b68f7182feaa2 100644
--- a/llvm/test/tools/llvm-reduce/reduce-operands-alloca.ll
+++ b/llvm/test/tools/llvm-reduce/reduce-operands-alloca.ll
@@ -67,3 +67,15 @@ define void @alloca_constexpr_elt() {
store i32 0, ptr %alloca
ret void
}
+
+; CHECK-LABEL: @alloca_lifetimes(
+; ZERO: call void @llvm.lifetime.start.p0(i64 4, ptr %alloca)
+; ONE: call void @llvm.lifetime.start.p0(i64 4, ptr %alloca)
+; POISON: call void @llvm.lifetime.start.p0(i64 4, ptr %alloca)
+define void @alloca_lifetimes() {
+ %alloca = alloca i32
+ call void @llvm.lifetime.start.p0(i64 4, ptr %alloca)
+ store i32 0, ptr %alloca
+ call void @llvm.lifetime.end.p0(i64 4, ptr %alloca)
+ ret void
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
index 8b6446725b7d4..79272fe2eaeb7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
@@ -73,6 +73,9 @@ static bool shouldReduceOperand(Use &Op) {
if (&CB->getCalledOperandUse() == &Op)
return false;
}
+ // lifetime intrinsic argument must be an alloca.
+ if (isa<LifetimeIntrinsic>(Op.getUser()))
+ return false;
return true;
}
More information about the llvm-commits
mailing list