[PATCH] D131204: llvm-reduce: add a pass for cleaning up branches

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 14:33:25 PDT 2022


arsenm 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)));
+    }
----------------
I was looking at doing this by calling simplifyCFG on each block rather than reimplementing the transform


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131204/new/

https://reviews.llvm.org/D131204



More information about the llvm-commits mailing list