[PATCH] D131204: llvm-reduce: add a pass for cleaning up branches
John Regehr via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 14:42:06 PDT 2022
regehr added inline comments.
================
Comment at: llvm/tools/llvm-reduce/deltas/ReduceBranches.cpp:25-33
+static void reduceConditionalBranchesTrue(Oracle &O, Module &Program) {
+ for (auto &F : Program) {
+ for (auto &BB : F) {
+ BranchInst *BI = dyn_cast<BranchInst>(BB.getTerminator());
+ if (BI && BI->isConditional() && !O.shouldKeep())
+ ReplaceInstWithInst(BI, BranchInst::Create(BI->getSuccessor(0)));
+ }
----------------
arsenm wrote:
> I was looking at doing this by calling simplifyCFG on each block rather than reimplementing the transform
since the code here is pretty short and simple, how about we just add that onto what I've done here?
none of the transforms here is strictly subsumed by anything in simplifyCFG because that pass has to be semantics-preserving, whereas none of these three are
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131204/new/
https://reviews.llvm.org/D131204
More information about the llvm-commits
mailing list