[llvm-branch-commits] [llvm] 3df0dac - [IndVars] Quick fix LHS/RHS bug
Max Kazantsev via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 3 21:39:43 PST 2020
Author: Max Kazantsev
Date: 2020-12-04T12:34:42+07:00
New Revision: 3df0daceb2c684c8bd704595e70c08500bb051ed
URL: https://github.com/llvm/llvm-project/commit/3df0daceb2c684c8bd704595e70c08500bb051ed
DIFF: https://github.com/llvm/llvm-project/commit/3df0daceb2c684c8bd704595e70c08500bb051ed.diff
LOG: [IndVars] Quick fix LHS/RHS bug
The code relies on fact that LHS is the NarrowDef but never
really checks it. Adding the conservative restrictive check,
will follow-up with handling of case where RHS is a NarrowDef.
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index d37fe74a0039..8842dfed3672 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1595,6 +1595,9 @@ bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) {
return false;
const SCEV *LHS = SE->getSCEV(OBO->getOperand(0));
const SCEV *RHS = SE->getSCEV(OBO->getOperand(1));
+ // TODO: Support case for NarrowDef = NarrowUse->getOperand(1).
+ if (NarrowUse->getOperand(0) != NarrowDef)
+ return false;
if (!SE->isKnownNegative(RHS))
return false;
bool ProvedSubNUW = SE->isKnownPredicateAt(
More information about the llvm-branch-commits
mailing list