diff options
author | Philip Reames <listmail@philipreames.com> | 2021-02-26 11:50:40 -0800 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-02-26 11:51:32 -0800 |
commit | 0832a58e22dedb26c508405fbd4f0cc8de562244 (patch) | |
tree | 31c31b192aa52648437d7c5c6f3311d85e7d6388 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | c5c316f6d9eeecae6de538ff554ae8066ebecb91 (diff) | |
download | llvm-0832a58e22dedb26c508405fbd4f0cc8de562244.zip llvm-0832a58e22dedb26c508405fbd4f0cc8de562244.tar.gz llvm-0832a58e22dedb26c508405fbd4f0cc8de562244.tar.bz2 |
[cgp] Minor code improvement - reuse an existing named helper [NFC]
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index f81d097..ed83fad 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. |