diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2012-11-13 03:12:40 +0000 | 
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2012-11-13 03:12:40 +0000 | 
| commit | 2a1df367d428608e7697b2cb09835ad3fd984fe2 (patch) | |
| tree | d57e506ca776bcb2c70784c4941bbc104e0e6269 /llvm/lib/Transforms | |
| parent | 5ce1d01887c3a49f158eb6466b191bcf68781aea (diff) | |
| download | bcm5719-llvm-2a1df367d428608e7697b2cb09835ad3fd984fe2.tar.gz bcm5719-llvm-2a1df367d428608e7697b2cb09835ad3fd984fe2.zip | |
BBVectorize: Don't vectorize vector-manipulation chains
Don't choose a vectorization plan containing only shuffles and
vector inserts/extracts. Due to inperfections in the cost model,
these can lead to infinite recusion.
llvm-svn: 167811
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/BBVectorize.cpp | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp index 32a37bad7fe..a2c3ad7d46b 100644 --- a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp @@ -1703,10 +1703,20 @@ assert(n < 10 && "hrmm, really?");          // The set of pairs that have already contributed to the total cost.          DenseSet<ValuePair> IncomingPairs; +        // If the cost model were perfect, this might not be necessary; but we +        // need to make sure that we don't get stuck vectorizing our own +        // shuffle chains. +        bool HasNontrivialInsts = false; +          // The node weights represent the cost savings associated with          // fusing the pair of instructions.          for (DenseSet<ValuePair>::iterator S = PrunedTree.begin(),               E = PrunedTree.end(); S != E; ++S) { +          if (!isa<ShuffleVectorInst>(S->first) && +              !isa<InsertElementInst>(S->first) && +              !isa<ExtractElementInst>(S->first)) +            HasNontrivialInsts = true; +            bool FlipOrder = false;            if (getDepthFactor(S->first)) { @@ -1943,6 +1953,13 @@ assert(n < 10 && "hrmm, really?");              }            }          } + +        if (!HasNontrivialInsts) { +          DEBUG(if (DebugPairSelection) dbgs() << +                "\tNo non-trivial instructions in tree;" +                " override to zero effective size\n"); +          EffSize = 0; +        }        } else {          for (DenseSet<ValuePair>::iterator S = PrunedTree.begin(),               E = PrunedTree.end(); S != E; ++S) | 

