summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-11-14 20:00:34 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-11-14 20:00:34 +0000
commit2bcdf1ebc9548e3cfcfc0ff46b3a6c2fac40c799 (patch)
tree031e11db383fdf27f4de70c6fa6b13c3e15aec18 /lib/Target/SystemZ
parent40a2f42a15dbe1fe01290ab055d7c0dcc47e44fd (diff)
[SystemZ] Do not crash when selecting an OR of two constants
In rare cases, common code will attempt to select an OR of two constants. This confuses the logic in splitLargeImmediate, causing an internal error during isel. Fixed by simply leaving this case to common code to handle. This fixes PR34859. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ')
-rw-r--r--lib/Target/SystemZ/SystemZISelDAGToDAG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp b/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
index 802af1ae861..3073d2fcde1 100644
--- a/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
+++ b/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
@@ -1263,8 +1263,10 @@ void SystemZDAGToDAGISel::Select(SDNode *Node) {
// Fall through.
or_xor:
// If this is a 64-bit operation in which both 32-bit halves are nonzero,
- // split the operation into two.
- if (Node->getValueType(0) == MVT::i64)
+ // split the operation into two. If both operands here happen to be
+ // constant, leave this to common code to optimize.
+ if (Node->getValueType(0) == MVT::i64 &&
+ Node->getOperand(0).getOpcode() != ISD::Constant)
if (auto *Op1 = dyn_cast<ConstantSDNode>(Node->getOperand(1))) {
uint64_t Val = Op1->getZExtValue();
if (!SystemZ::isImmLF(Val) && !SystemZ::isImmHF(Val)) {