[PATCH] D42737: [LegalizeDAG] Truncate condition operand of ISD::SELECT

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 04:16:11 PST 2018


evgeny777 added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:368
 
+  // Truncate the condition if needed
+  auto BoolVT = getSetCCResultType(CondVT);
----------------
delena wrote:
> Can the condition be wider than getSetCCResultType?
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`. 



================
Comment at: test/CodeGen/AArch64/expand-select.ll:4
+; Check that we don't crash
+; RUN: llc -mtriple=aarch64-unknown-linux-gnu -O3 %s -o -
+
----------------
delena wrote:
> I think you should put here regular CHECKs, like in all other llc tests.
Any suggestion on what should be checked? Probably debug output from `-debug-only=selectiondag,isel`?


https://reviews.llvm.org/D42737





More information about the llvm-commits mailing list