Most of insertelement constant folding is blocked if the vector type
is scalable. I believe we can make an exception for inserting null
into an all zeros vector.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/IR/ConstantFold.cpp | ||
---|---|---|
696 | This could go before the CIdx check. Also, this holds fold any splat Val (e.g. UndefValue or PoisonValue), not just zero. |
Comment Actions
LG, but please add a dedicated test for this (in test/Transforms/InstSimplify/ConstantFold or something).
llvm/lib/IR/ConstantFold.cpp | ||
---|---|---|
687 | I believe this should hold for any insertion of a constant into a splat of the same value. Poison/Undef/Zero are all just special cases of that. |
I believe this should hold for any insertion of a constant into a splat of the same value. Poison/Undef/Zero are all just special cases of that.