aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-10-03 07:41:46 +0000
committerDuncan Sands <baldrick@free.fr>2008-10-03 07:41:46 +0000
commit1a37bd7c7e7abbd99f4d33a0788e4b20aa67ac0f (patch)
tree858c63aa5f0e087ba2d1a383f83f802eaddd9861 /lib
parent349bf2e29f53aa64e7d4e906b84e9d4199a59760 (diff)
downloadexternal_llvm-1a37bd7c7e7abbd99f4d33a0788e4b20aa67ac0f.tar.gz
external_llvm-1a37bd7c7e7abbd99f4d33a0788e4b20aa67ac0f.tar.bz2
external_llvm-1a37bd7c7e7abbd99f4d33a0788e4b20aa67ac0f.zip
The result of getSetCCResultType (eg: i32) may be larger
than the type an i1 is promoted to (eg: i8). Account for this. Noticed by Tilmann Scheller on CellSPU; he will hopefully take care of fixing this in LegalizeDAG and adding a testcase! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 2e5f8bea80..588c24e8aa 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -365,10 +365,14 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SELECT_CC(SDNode *N) {
}
SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
- assert(isTypeLegal(TLI.getSetCCResultType(N->getOperand(0)))
- && "SetCC type is not legal??");
- return DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(N->getOperand(0)),
- N->getOperand(0), N->getOperand(1), N->getOperand(2));
+ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
+ MVT SVT = TLI.getSetCCResultType(N->getOperand(0));
+ assert(isTypeLegal(SVT) && "SetCC type not legal??");
+ assert(NVT.getSizeInBits() <= SVT.getSizeInBits() &&
+ "Integer type overpromoted?");
+ return DAG.getNode(ISD::TRUNCATE, NVT,
+ DAG.getNode(ISD::SETCC, SVT, N->getOperand(0),
+ N->getOperand(1), N->getOperand(2)));
}
SDValue DAGTypeLegalizer::PromoteIntRes_SHL(SDNode *N) {