[PATCH] D38756: [x86] use an insert op to put one variable element into a constant of vectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 14:37:51 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D38756#893854, @efriedma wrote:

> > This doesn't happen with int constants...because int constants are legal but FP constants are not?
>
> Yes, exactly.
>
> We call LowerBUILD_VECTOR before we legalize the operands of a BUILD_VECTOR, so that shouldn't block this optimization.  But we don't recompute the topological ordering when you create new nodes, so legalization can happen in an unexpected order if you create illegal nodes (by, for example, calling getBuildVector()).


Ah, so I should be checking legality of the BV and the insert to be safe? 
I tried to work-around the FP issue by creating a constant pool load, but that got a bit ugly - I had to call LowerConstantPool() to create a legal vector of constants. Am I just waiting too long by trying to do this in lowering rather than combining? I did try this as a combine too, but that caused an inf-loop with the opposite DAGCombiner transform that sticks the insertelement back into the BV.


https://reviews.llvm.org/D38756





More information about the llvm-commits mailing list