[llvm-branch-commits] [llvm-branch] r223638 - Merging r217115:
David Majnemer
david.majnemer at gmail.com
Mon Dec 8 00:50:40 PST 2014
Author: majnemer
Date: Mon Dec 8 02:50:39 2014
New Revision: 223638
URL: http://llvm.org/viewvc/llvm-project?rev=223638&view=rev
Log:
Merging r217115:
------------------------------------------------------------------------
r217115 | majnemer | 2014-09-03 17:23:13 -0700 (Wed, 03 Sep 2014) | 3 lines
IndVarSimplify: Address review comments for r217102
No functional change intended, just some cleanups and comments added.
------------------------------------------------------------------------
Modified:
llvm/branches/release_35/ (props changed)
llvm/branches/release_35/lib/Transforms/Scalar/IndVarSimplify.cpp
Propchange: llvm/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 8 02:50:39 2014
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,213653,213665,213726,213749,213773,213793,213798-213799,213815,213847,213880,213883-213884,213894-213896,213899,213915,213966,213999,214060,214129,214180,214287,214331,214423,214429,214519,214670,214674,214679,215685,215711,215806,216064,216262,216531,216920,217102,217257,218745,221009,221408,221453,221501,222338,222376,223163,223170-223171
+/llvm/trunk:155241,213653,213665,213726,213749,213773,213793,213798-213799,213815,213847,213880,213883-213884,213894-213896,213899,213915,213966,213999,214060,214129,214180,214287,214331,214423,214429,214519,214670,214674,214679,215685,215711,215806,216064,216262,216531,216920,217102,217115,217257,218745,221009,221408,221453,221501,222338,222376,223163,223170-223171
Modified: llvm/branches/release_35/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=223638&r1=223637&r2=223638&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/branches/release_35/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Dec 8 02:50:39 2014
@@ -1626,16 +1626,19 @@ LinearFunctionTestReplace(Loop *L,
// The BackedgeTaken expression contains the number of times that the
// backedge branches to the loop header. This is one less than the
// number of times the loop executes, so use the incremented indvar.
- llvm::Value *IncrementedIndvar = IndVar->getIncomingValueForBlock(L->getExitingBlock());
+ llvm::Value *IncrementedIndvar =
+ IndVar->getIncomingValueForBlock(L->getExitingBlock());
const auto *IncrementedIndvarSCEV =
cast<SCEVAddRecExpr>(SE->getSCEV(IncrementedIndvar));
// It is unsafe to use the incremented indvar if it has a wrapping flag, we
// don't want to compare against a poison value. Check the SCEV that
// corresponds to the incremented indvar, the SCEVExpander will only insert
// flags in the IR if the SCEV originally had wrapping flags.
- if (ScalarEvolution::maskFlags(IncrementedIndvarSCEV->getNoWrapFlags(),
- SCEV::FlagNUW | SCEV::FlagNSW) ==
- SCEV::FlagAnyWrap) {
+ // FIXME: In theory, SCEV could drop flags even though they exist in IR.
+ // A more robust solution would involve getting a new expression for
+ // CmpIndVar by applying non-NSW/NUW AddExprs.
+ if (!ScalarEvolution::maskFlags(IncrementedIndvarSCEV->getNoWrapFlags(),
+ SCEV::FlagNUW | SCEV::FlagNSW)) {
// Add one to the "backedge-taken" count to get the trip count.
// This addition may overflow, which is valid as long as the comparison is
// truncated to BackedgeTakenCount->getType().
More information about the llvm-branch-commits
mailing list