[PATCH] Fix for wrong instcombine on vector insert/extract
Benjamin Kramer
benny.kra at gmail.com
Thu Apr 11 07:46:15 PDT 2013
On 11.04.2013, at 16:14, Andrea_DiBiagio at sn.scee.net wrote:
> Ping
Patch looks good to me. Do you have commit access?
- Ben
>
> -- Andrea DiBiagio
>
> Andrea DiBiagio/SN R&D/BS/UK/SCEE wrote on 03/04/2013 13:24:02:
>
>> From: Andrea DiBiagio/SN R&D/BS/UK/SCEE
>> To: Andrea DiBiagio/SN R&D/BS/UK/SCEE at SCEE
>> Cc: llvm-commits at cs.uiuc.edu
>> Date: 03/04/2013 13:24
>> Subject: Re: [PATCH] Fix for wrong instcombine on vector insert/extract
>>
>> Oops. I just noticed that my last email didn't thread correctly.
>> I am reattaching an updated patch against the latest revision for
>> completeness.
>>
>> [attachment "InstCombinePatch.diff" deleted by Andrea DiBiagio/SN
>> R&D/BS/UK/SCEE]
>>
>> Sorry for the spam.
>> Andrea Di Biagio
>>
>> Andrea DiBiagio/SN R&D/BS/UK/SCEE wrote on 03/04/2013 13:06:44:
>>
>>> From: Andrea DiBiagio/SN R&D/BS/UK/SCEE
>>> To: llvm-commits at cs.uiuc.edu
>>> Date: 03/04/2013 13:06
>>> Subject: Re: [PATCH] Fix for wrong instcombine on vector insert/extract
>>>
>>> Friendly Ping.
>>>
>>> Andrea DiBiagio/SN R&D/BS/UK/SCEE wrote on 22/03/2013 19:53:00:
>>>
>>>> From: Andrea DiBiagio/SN R&D/BS/UK/SCEE
>>>> To: llvm-commits at cs.uiuc.edu
>>>> Date: 22/03/2013 19:53
>>>> Subject: [PATCH] Fix for wrong instcombine on vector insert/extract
>>>>
>>>> Hello,
>>>>
>>>> I would like to contribute a fix for a wrong transformation performed
>>>> by the Instruction Combiner on sequences of
> insertelement/extractelement
>>>> instructions.
>>>>
>>>> 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.
>>>>
>>>> The patch in attachment fixes the problem with the wrong
>>>> propagation of shuffle indexes.
>>>> It also adds two extra cases to test
>>>> Transforms/InstCombine/vec_shuffle.ll to check that now we
>>>> do the correct thing when collapsing sequences of insert/extract
>>>> element instruction in that problematic scenario.
>>>>
>>>> Thanks!
>>>> Andrea Di Biagio
>>>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list