llvm-6502/lib/Transforms
Benjamin Kramer c37cb66e6e Fix for wrong instcombine on vector insert/extract
When trying to collapse sequences of insertelement/extractelement
instructions into single shuffle instructions, there is one specific
case where the Instruction Combiner wrongly updates the resulting
Mask of shuffle indexes.

The problem is in function CollectShuffleElments.

If we have a sequence of insert/extract element instructions
like the one below:

  %tmp1 = extractelement <4 x float> %LHS, i32 0
  %tmp2 = insertelement <4 x float> %RHS, float %tmp1, i32 1
  %tmp3 = extractelement <4 x float> %RHS, i32 2
  %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 3

Where:
  . %RHS will have a mask of [4,5,6,7]
  . %LHS will have a mask of [0,1,2,3]

The Mask of shuffle indexes is wrongly computed to [4,1,6,7]
instead of [4,0,6,7].
When analyzing %tmp2 in order to compute the Mask for the
resulting shuffle instruction, the algorithm forgets to update
the mask index at position 1 with the index associated to the
element extracted from %LHS by instruction %tmp1.

Patch by Andrea DiBiagio!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179291 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11 15:10:09 +00:00
..
Hello Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
InstCombine Fix for wrong instcombine on vector insert/extract 2013-04-11 15:10:09 +00:00
Instrumentation [ASan] Allow disabling init-order checks for globals by source file name. 2013-04-11 13:20:00 +00:00
IPO Use a worklist to avoid a sneaky iterator invalidation. 2013-04-02 08:16:45 +00:00
ObjCARC Fix some comment typos. 2013-04-09 22:15:51 +00:00
Scalar Redo the fix Benjamin Kramer committed in r178793 about iterator invalidation in Reassociate. 2013-04-08 22:00:43 +00:00
Utils Change CloneFunctionInto to always clone Argument attributes induvidually, 2013-04-10 10:37:38 +00:00
Vectorize Rename the C function to create a SLPVectorizerPass to something sane and expose it in the header file. 2013-04-11 11:36:36 +00:00
CMakeLists.txt Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer. 2013-01-28 01:35:51 +00:00
LLVMBuild.txt Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer. 2013-01-28 01:35:51 +00:00
Makefile Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer. 2013-01-28 01:35:51 +00:00