[llvm] 0832a58 - [cgp] Minor code improvement - reuse an existing named helper [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 11:51:38 PST 2021
Author: Philip Reames
Date: 2021-02-26T11:51:32-08:00
New Revision: 0832a58e22dedb26c508405fbd4f0cc8de562244
URL: https://github.com/llvm/llvm-project/commit/0832a58e22dedb26c508405fbd4f0cc8de562244
DIFF: https://github.com/llvm/llvm-project/commit/0832a58e22dedb26c508405fbd4f0cc8de562244.diff
LOG: [cgp] Minor code improvement - reuse an existing named helper [NFC]
Added:
Modified:
llvm/lib/CodeGen/CodeGenPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index f81d0971b4c5..ed83fad2ebdd 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1290,9 +1290,9 @@ bool CodeGenPrepare::replaceMathCmpWithIntrinsic(BinaryOperator *BO,
const BasicBlock *Latch = L->getLoopLatch();
if (PN->getIncomingValueForBlock(Latch) != BO)
return false;
- if (auto *Step = dyn_cast<Instruction>(BO->getOperand(1)))
- if (L->contains(Step->getParent()))
- return false;
+ if (!L->isLoopInvariant(BO->getOperand(1)))
+ // Avoid complexities w/loop varying steps.
+ return false;
// IV increment may have other users than the IV. We do not want to make
// dominance queries to analyze the legality of moving it towards the cmp,
// so just check that there is no other users.
More information about the llvm-commits
mailing list