[LLVMdev] vectorize a def-use chain

Frank Winter fwinter at jlab.org
Wed Jul 8 15:18:03 PDT 2015


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




More information about the llvm-dev mailing list