As discussed in:
https://bugs.llvm.org/show_bug.cgi?id=32486
...the canonicalization of vector select to shufflevector does not hold up when undef elements are present in the condition vector.
Details
Diff Detail
Event Timeline
docs/LangRef.rst | ||
---|---|---|
7077 |
This is technically true, but not really a useful statement. Probably better to explicitly state that an element of the result is undef iff the chosen element of the input is undef. | |
lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
1059 | You could treat the undef as if it were true or false here (just pick arbitrarily), but I'm not sure what the right heuristic would be. You can just leave it for now, I guess. |
Patch updated:
Replace a low value statement about shuffle undef-ness in the LangRef.
lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
1059 | Right - I thought about that as a follow-up. We can handle the case where all defined elements are coming from one side or the other by choosing the undef elements from the same side. That could be done in instsimplify, so all we're left with here is the case where we are choosing from both sides and have undef elements. |
This is technically true, but not really a useful statement. Probably better to explicitly state that an element of the result is undef iff the chosen element of the input is undef.