[SCEV] Call `StrengthenNoWrapFlags` after `GroupByComplexity`; NFCI
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 9 Oct 2015 02:44:45 +0000 (02:44 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 9 Oct 2015 02:44:45 +0000 (02:44 +0000)
The current implementation of `StrengthenNoWrapFlags` is agnostic to the
order of `Ops`, so this commit should not change anything semantic.  An
upcoming change will make `StrengthenNoWrapFlags` sensitive to the order
of `Ops`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249802 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 4181ee6446adace97116e1fdfd996e2e0a602360..5843ed76fa24518e3ff86abe136cb283f20571c3 100644 (file)
@@ -1960,11 +1960,11 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
            "SCEVAddExpr operand types don't match!");
 #endif
 
-  Flags = StrengthenNoWrapFlags(this, scAddExpr, Ops, Flags);
-
   // Sort by complexity, this groups all similar expression types together.
   GroupByComplexity(Ops, &LI);
 
+  Flags = StrengthenNoWrapFlags(this, scAddExpr, Ops, Flags);
+
   // If there are any constants, fold them together.
   unsigned Idx = 0;
   if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) {
@@ -2368,11 +2368,11 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
            "SCEVMulExpr operand types don't match!");
 #endif
 
-  Flags = StrengthenNoWrapFlags(this, scMulExpr, Ops, Flags);
-
   // Sort by complexity, this groups all similar expression types together.
   GroupByComplexity(Ops, &LI);
 
+  Flags = StrengthenNoWrapFlags(this, scMulExpr, Ops, Flags);
+
   // If there are any constants, fold them together.
   unsigned Idx = 0;
   if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) {