summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMISelLowering.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2012-02-24 00:09:36 +0000
committerDan Gohman <gohman@apple.com>2012-02-24 00:09:36 +0000
commitd4a77c46827be6961ac088c398c3b0e8614518a9 (patch)
treea3c199b30b69964355e30d8832c8ba1ac2b07ac4 /llvm/lib/Target/ARM/ARMISelLowering.cpp
parentd2c15e4c8ad6c4fe6e3b1a97c5a3e4b93dc0de8b (diff)
downloadbcm5719-llvm-d4a77c46827be6961ac088c398c3b0e8614518a9.tar.gz
bcm5719-llvm-d4a77c46827be6961ac088c398c3b0e8614518a9.zip
When emitting a cmp with 0 for a lowered select, mask out the high
bits of the value carying the boolean condition, as their contents are undefined. This fixes rdar://10887484. llvm-svn: 151310
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 8a02162665f..94ddf861067 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -2841,6 +2841,11 @@ SDValue ARMTargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) const {
}
}
+ // ARM's BooleanContents value is UndefinedBooleanContent. Mask out the
+ // undefined bits before doing a full-word comparison with zero.
+ Cond = DAG.getNode(ISD::AND, dl, Cond.getValueType(), Cond,
+ DAG.getConstant(1, Cond.getValueType()));
+
return DAG.getSelectCC(dl, Cond,
DAG.getConstant(0, Cond.getValueType()),
SelectTrue, SelectFalse, ISD::SETNE);
OpenPOWER on IntegriCloud