[PATCH] D11648: InstCombinePHI: Partial simplification of identity operations

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 14:05:07 PDT 2015


kuhar added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:846-855
@@ +845,12 @@
+
+  // Cannot hoist an operation if the incoming BasicBlock has conditional branch
+  // and when the new instruction could result in trap.
+  // If the Terminator is not a BranchInst we don't apply the transformation,
+  // since it's not obvious if that'd be a performance win and if it'd be safe.
+  if (const auto *BI = dyn_cast<BranchInst>(Terminator)) {
+    if (BI->isConditional() && (PNUser.getOpcode() == Instruction::UDiv ||
+                                PNUser.getOpcode() == Instruction::SDiv))
+      return nullptr;
+  } else
+    return nullptr;
+
----------------
majnemer wrote:
> Why not just check if `BB->getUniqueSuccessor() != nullptr`?
Do you also suggest removing this check for UDiv/SDiv with conditional branch?


Repository:
  rL LLVM

http://reviews.llvm.org/D11648





More information about the llvm-commits mailing list