[PATCH] D29489: Optimize SETCC + VSEL of incompatible or illegal types

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 04:57:49 PST 2017


jonpa updated this revision to Diff 88511.
jonpa added a comment.

Patch updated according to suggestions.

> Type legalization for SIGN_EXTEND(SETCC) should do the right thing, as opposed to special-casing VSELECT(SETCC), because it's more general. For example, consider the IR sext(icmp <4 x i32>...).

With the improvements in ComputeNumSignBits(), the call to the special-case VSELECT(SETCC) handling is not as needed as before (called in one place).

I tried again to get rid of it, and did another attempt in using the DAGCombiner to handle SIGN_EXTEND_VECTOR_INREG. It removes BUILD_VECTOR -> EXTRACT_VECTOR_ELTs -> SIGN_EXTEND_VECTOR_INREG when the types of BUILD_VECTOR and the operand of SIGN_EXTEND_VECTOR_INREG are the same. Unfortunately, there were a few cases of VSELECT result widening that this didn't handle, so I could not remove that call still. Therefore, this new attempt in the DAGCombiner was fruitless and not part of the patch.

> Bitcasts aren't transparent in general: the integer width changes, or the operand might not even be an integer.

These have to be handled here. Do you think the update patch is making sense? If we can't handle the bistcasts like this, I think I would have to go back to calling the new method also for these cases. I suppose then these improvements in ComputeNumSignBits() are not needed here anymore, but could still perhaps be part of a separate patch. (btw I think I see an assert in that method that this is indeed an integer type).


https://reviews.llvm.org/D29489

Files:
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29489.88511.patch
Type: text/x-patch
Size: 6480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170215/072a3143/attachment.bin>


More information about the llvm-commits mailing list