[PATCH] Fix for wrong instcombine on vector insert/extract

Andrea_DiBiagio at sn.scee.net Andrea_DiBiagio at sn.scee.net
Wed Apr 3 05:24:02 PDT 2013


Oops. I just noticed that my last email didn't thread correctly.
I am reattaching an updated patch against the latest revision for 
completeness.



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
> > 


**********************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify postmaster at scee.net
This footnote also confirms that this email message has been checked for 
all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United 
Kingdom
Registered in England: 3277793
**********************************************************************

P Please consider the environment before printing this e-mail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InstCombinePatch.diff
Type: application/octet-stream
Size: 2382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130403/4b7cede9/attachment.obj>


More information about the llvm-commits mailing list