[PATCH] D11648: InstCombinePHI: Partial simplification of identity operations
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 10:31:24 PDT 2015
majnemer 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;
+
----------------
Why not just check if `BB->getUniqueSuccessor() != nullptr`?
Repository:
rL LLVM
http://reviews.llvm.org/D11648
More information about the llvm-commits
mailing list