[LLVMdev] vectorize a def-use chain

Michael Zolotukhin mzolotukhin at apple.com
Wed Jul 8 15:38:21 PDT 2015


Hi Frank,

SLP vectorizer does something like this. For question (2) you could take a glance at BoUpSLP::vectorizeTree(TreeEntry *E) (file lib/Transforms/Vectorize/SLPVectorizer.cpp) - it also has an example of retrieving an instruction’s opcode and constructing vector operands.

Michael

> On Jul 8, 2015, at 3:18 PM, Frank Winter <fwinter at jlab.org> wrote:
> 
> I'd like to replace scalar instructions with vector instructions such that the code corresponding to following tree would be vectorized:
> 
> load0  load1
>  \     /
>   \   /
>    add/sub/mul
>     |
>     |
>   store
> 
> I had unsuccessful encounters with load0->replaceAllUsesWith(vec_load0) complaining about mismatching type (makes sense, add's other operand is still scalar at that time..)
> 
> Is the only way to create a vectorized version of this tree by
> 
> 1) creating the vector loads vec_load0 AND vec_load1
> 2) retrieving the opcode of the arithmetic instruction and create a new one according to the opcode
> 
> How is step 2) in donepractice? Cloning the instruction and replacing the operands? (would that bypass the type checking for a moment?)
> 
> Thanks,
> Frank
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150708/d93a6c83/attachment.html>


More information about the llvm-dev mailing list