I'm facing a crash when compiling large in-house project for AArch64 using clang, which happens because condition argument of ISD::SELECT can't be expanded (for my case required expansion is i128 -> i64). This patch adds required support.
Details
Diff Detail
Event Timeline
It seems a little dubious to create a SELECT where the condition isn't either an i1 or a naturally promoted i1... maybe it would make sense to restrict that instead? (And fix the VSELECT expansion to just truncate the condition instead of trying to get fancy.)
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
3118 | Probably want to clarify that you're intentionally throwing away the high bits because the operand is required to conform to getBooleanContents. |
Addressed review comments. The new version also handles scalar types which size is not power of 2.
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | ||
---|---|---|
368 ↗ | (On Diff #132335) | Yes, if this wider type is legal for target architecture. However see @efriedma comment above. If boolean type is not legal then you either crash when trying to expand condition or when trying to promote it (if type bit width is not power of 2). Here I chose to truncate it to size of getSetCCResultType to avoid promoting it back in PromoteTargetBoolean. |
test/CodeGen/AArch64/expand-select.ll | ||
5 | Any suggestion on what should be checked? Probably debug output from -debug-only=selectiondag,isel? |
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | ||
---|---|---|
368 ↗ | (On Diff #132335) | My question was incorrect. I wanted to ask whether the getSetCCResultType may be wider than Cond. Do you need to extend the Cond in this case? |
test/CodeGen/AArch64/expand-select.ll | ||
5 | just use utils/update_llc_test_checks.py to generate "CHECKS": utils/update_llc_test_checks.py --llc-binary=<path>/llc test/CodeGen/AArch64/expand-select.ll |
Probably want to clarify that you're intentionally throwing away the high bits because the operand is required to conform to getBooleanContents.