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( _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits