https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/133387
Ideally shouldKeep is only called in contexts that will successfully do something. >From 58d33e17db2853fab62c6d762897f23f2f03f414 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <matthew.arsena...@amd.com> Date: Fri, 28 Mar 2025 12:58:20 +0700 Subject: [PATCH] llvm-reduce: Defer a shouldKeep call in operand reduction Ideally shouldKeep is only called in contexts that will successfully do something. --- llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp index 8c69b1cc202eb..6bf1ec8d61688 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp @@ -26,8 +26,8 @@ extractOperandsFromModule(Oracle &O, ReducerWorkItem &WorkItem, for (auto &I : instructions(&F)) { if (PHINode *Phi = dyn_cast<PHINode>(&I)) { for (auto &Op : Phi->incoming_values()) { - if (!O.shouldKeep()) { - if (Value *Reduced = ReduceValue(Op)) + if (Value *Reduced = ReduceValue(Op)) { + if (!O.shouldKeep()) Phi->setIncomingValueForBlock(Phi->getIncomingBlock(Op), Reduced); } } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits