[PATCH] D51000: [BypassSlowDivision] Teach bypass slow division not to interfere with div by constant where constants have been constant hoisted, but not moved from their basic block
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 16:23:04 PDT 2018
spatel added inline comments.
================
Comment at: lib/Transforms/Utils/BypassSlowDivision.cpp:395-397
+ if (isa<BitCastInst>(Divisor) &&
+ cast<BitCastInst>(Divisor)->getParent() == SlowDivOrRem->getParent() &&
+ isa<ConstantInt>(cast<BitCastInst>(Divisor)->getOperand(0))) {
----------------
Use dyn_cast to reduce code:
if (auto *BitCast = dyn_cast<BitCastInst>(Divisor))
if (BitCast->getParent() == SlowDivOrRem->getParent() &&
isa<ConstantInt>(BitCast->getOperand(0)))
return None;
https://reviews.llvm.org/D51000
More information about the llvm-commits
mailing list