diff options
author | Stuart Hastings <stuart@apple.com> | 2011-05-12 23:36:41 +0000 |
---|---|---|
committer | Stuart Hastings <stuart@apple.com> | 2011-05-12 23:36:41 +0000 |
commit | 89f1b47e3a9ba07ff22c9aad962acc84bc5b1cab (patch) | |
tree | 0c2394da23605f6c7aef3880705b6915eb73366f /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 1f69a02fb98abdd9fe65be25a061419ba08321ef (diff) | |
download | bcm5719-llvm-89f1b47e3a9ba07ff22c9aad962acc84bc5b1cab.tar.gz bcm5719-llvm-89f1b47e3a9ba07ff22c9aad962acc84bc5b1cab.zip |
Non-fast-isel followup to 129634; correctly handle branches controlled
by non-CMP expressions. The executable test case (129821) would test
this as well, if we had an "-O0 -disable-arm-fast-isel" LLVM-GCC
tester. Alas, the ARM assembly would be very difficult to check with
FileCheck.
The thumb2-cbnz.ll test is affected; it generates larger code (tst.w
vs. cmp #0), but I believe the new version is correct.
rdar://problem/9298790
llvm-svn: 131261
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index e2e6691ba7c..5a833d335c1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3535,9 +3535,16 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node, Tmp2.getOperand(0), Tmp2.getOperand(1), Node->getOperand(2)); } else { + // We test only the i1 bit. Skip the AND if UNDEF. + Tmp3 = (Tmp2.getOpcode() == ISD::UNDEF || + (Tmp2.getOpcode() == ISD::AND && + Tmp2.getConstantOperandVal(1) == 1)) ? + Tmp2 : + DAG.getNode(ISD::AND, dl, Tmp2.getValueType(), Tmp2, + DAG.getConstant(1, Tmp2.getValueType())); Tmp1 = DAG.getNode(ISD::BR_CC, dl, MVT::Other, Tmp1, - DAG.getCondCode(ISD::SETNE), Tmp2, - DAG.getConstant(0, Tmp2.getValueType()), + DAG.getCondCode(ISD::SETNE), Tmp3, + DAG.getConstant(0, Tmp3.getValueType()), Node->getOperand(2)); } Results.push_back(Tmp1); |