aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Attributes.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-03-31 11:43:19 +0000
committerHal Finkel <hfinkel@anl.gov>2014-03-31 11:43:19 +0000
commit02807595fb4b24db0fc642801beeda206ba576ca (patch)
tree2f7a2c6a59488e2166d5e5105607d43ef9cbf491 /clang/lib/Basic/Attributes.cpp
parent9ae7d3bd5f7bad36d8d318ce0ca846907b41826a (diff)
downloadllvm-02807595fb4b24db0fc642801beeda206ba576ca.zip
llvm-02807595fb4b24db0fc642801beeda206ba576ca.tar.gz
llvm-02807595fb4b24db0fc642801beeda206ba576ca.tar.bz2
Look at shuffles of build_vectors in DAGCombiner::visitEXTRACT_VECTOR_ELT
When the loop vectorizer vectorizes code that uses the loop induction variable, we often end up with IR like this: %b1 = insertelement <2 x i32> undef, i32 %v, i32 0 %b2 = shufflevector <2 x i32> %b1, <2 x i32> undef, <2 x i32> zeroinitializer %i = add <2 x i32> %b2, <i32 2, i32 3> If the add in this example is not legal (as is the case on PPC with VSX), it will be scalarized, and we'll end up with a number of extract_vector_elt nodes with the vector shuffle as the input operand, and that vector shuffle is fed by one or more build_vector nodes. By the time that vector operations are expanded, visitEXTRACT_VECTOR_ELT will not create new extract_vector_elt by looking through the vector shuffle (to make sure that no illegal operations are created), and so the extract_vector_elt -> vector shuffle -> build_vector is never simplified to an operand of the build vector. By looking at build_vectors through a shuffle we fix this particular situation, preventing a vector from being built, only to be deconstructed again (for the scalarized add) -- an expensive proposition when this all needs to be done via the stack. We probably want a more comprehensive fix here where we look back recursively through any shuffles to any build_vectors or scalar_to_vectors, etc. but that can come later. llvm-svn: 205179
Diffstat (limited to 'clang/lib/Basic/Attributes.cpp')
0 files changed, 0 insertions, 0 deletions