From 62b5aa984e845b95548ce85b4ecdd41a8683ae6b Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 9 Jun 2022 11:17:09 -0400 Subject: [PATCH] llvm-reduce: Check shouldKeep before trying to reduce operands No point doing the more complicated check first. --- llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp index 49a4837..9c713f5 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp @@ -23,9 +23,10 @@ extractOperandsFromModule(Oracle &O, Module &Program, for (auto &F : Program.functions()) { for (auto &I : instructions(&F)) { for (auto &Op : I.operands()) { - Value *Reduced = ReduceValue(Op); - if (Reduced && !O.shouldKeep()) - Op.set(Reduced); + if (!O.shouldKeep()) { + if (Value *Reduced = ReduceValue(Op)) + Op.set(Reduced); + } } } } -- 2.7.4