[PATCH] D136297: llvm-reduce: Skip reducing branches that already have the condition to set
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 14:57:41 PDT 2022
arsenm created this revision.
arsenm added reviewers: aeubanks, regehr, lebedev.ri.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
This should reduce the number of steps when resuming a
reduction.
https://reviews.llvm.org/D136297
Files:
llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
Index: llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
===================================================================
--- llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
+++ llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
@@ -39,7 +39,22 @@
for (auto &F : M) {
for (auto &BB : F) {
auto *BR = dyn_cast<BranchInst>(BB.getTerminator());
- if (!BR || !BR->isConditional() || O.shouldKeep())
+ if (!BR || !BR->isConditional())
+ continue;
+
+ // Skip cases that already have the value we're going to set this to.
+ ConstantInt *Cond = dyn_cast<ConstantInt>(BR->getCondition());
+ if (Cond) {
+ if (Direction) {
+ if (Cond->isOne())
+ continue;
+ } else {
+ if (Cond->isZero())
+ continue;
+ }
+ }
+
+ if (O.shouldKeep())
continue;
if (Direction)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136297.469057.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221019/74146009/attachment.bin>
More information about the llvm-commits
mailing list