This patch fixes bug 23800 ( https://llvm.org/bugs/show_bug.cgi?id=23800#c2 ). There existed a case where the index operand from extractelement was directly used to create a shufflevector mask. Since the index can be of any integral type but the mask must only contain 32 bit integers a 64 bit index operand led to an assertion error later on.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
1224 ↗ | (On Diff #28781) | The comment can just be "shufflemask must use an i32". It'd be nice if you could avoid re-uniquing the constant when it already is an i32. |
Yes, that's a fine way to do it.
It would be a little cleaner to pull out a function to do the entire -> i32 conversion, so that you can just have Args.push_back(getAsInt32(CGF, C));
Otherwise LGTM.
Sorry for accidentally accepting the revision myself.
I don't have commit rights so someone else will have to push the fix for me.
Thanks again for your help!
Hi Simon, is this test case enough? Clang will fail with an exit code other than 0 if wrong code is generated. The test passes with my changes. Or should I add a check to the test that something like <2 x i64> <i64 0, i64 undef> is not generated?
Yes please add a FileCheck stage to the test to give some insight as to what you expect the result to be.
A comment would be useful as well (reference the PR# and a brief explanation of the bug).