DAGCombine should not aggressively fold SEXT(VSETCC(...)) into a wider VSETCC without...
authorOwen Anderson <resistor@mac.com>
Tue, 23 Apr 2013 18:09:28 +0000 (18:09 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 23 Apr 2013 18:09:28 +0000 (18:09 +0000)
This exposed an issue with PowerPC AltiVec where it appears it was setting the wrong vector boolean contents.  The included change
fixes the PowerPC tests, and was OK'd by Hal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180129 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/PowerPC/PPCISelLowering.cpp

index 3b823ad9b6c74184eb2e04e8c331c62c36a72e71..f67cd3e27096872529a1cfa122461af54b7587cd 100644 (file)
@@ -4451,7 +4451,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
   if (N0.getOpcode() == ISD::SETCC) {
     // sext(setcc) -> sext_in_reg(vsetcc) for vectors.
     // Only do this before legalize for now.
-    if (VT.isVector() && !LegalOperations) {
+    if (VT.isVector() && !LegalOperations &&
+        TLI.getBooleanContents(true) == 
+          TargetLowering::ZeroOrNegativeOneBooleanContent) {
       EVT N0VT = N0.getOperand(0).getValueType();
       // On some architectures (such as SSE/NEON/etc) the SETCC result type is
       // of the same size as the compared operands. Only optimize sext(setcc())
index 333976b06c533885298d10bacad4f0ad27d3a935..27dfcdbfead24e673bda1fe4822182c91fb1ff96 100644 (file)
@@ -514,7 +514,7 @@ PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)
   setOperationAction(ISD::ATOMIC_STORE, MVT::i64, Expand);
 
   setBooleanContents(ZeroOrOneBooleanContent);
-  setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct?
+  setBooleanVectorContents(ZeroOrNegativeOneBooleanContent); // FIXME: Is this correct?
 
   if (isPPC64) {
     setStackPointerRegisterToSaveRestore(PPC::X1);