diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2022-01-10 18:31:29 -0800 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2022-01-10 18:32:13 -0800 |
commit | 301e9117400269489e39eabf2fcf8204bd7355d1 (patch) | |
tree | 8c8bbb7ab7f46e0ec2bd9b8c4a36fe02e7a8fca7 | |
parent | b607cd39281f71528f82f0de8b230fff7217dc7e (diff) | |
download | llvm-301e9117400269489e39eabf2fcf8204bd7355d1.tar.gz |
[TargetLowering] precommit refactor from D115688 NFC
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index b1ab4df62461..6af296d15dfd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -4603,9 +4603,7 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, case 'n': // Simple Integer case 's': { // Relocatable Constant - GlobalAddressSDNode *GA; ConstantSDNode *C; - BlockAddressSDNode *BA; uint64_t Offset = 0; // Match (GA) or (C) or (GA+C) or (GA-C) or ((GA+C)+C) or (((GA+C)+C)+C), @@ -4614,12 +4612,6 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, // while in this case the GA may be furthest from the root node which is // likely an ISD::ADD. while (true) { - if ((GA = dyn_cast<GlobalAddressSDNode>(Op)) && ConstraintLetter != 'n') { - Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), SDLoc(Op), - GA->getValueType(0), - Offset + GA->getOffset())); - return; - } if ((C = dyn_cast<ConstantSDNode>(Op)) && ConstraintLetter != 's') { // gcc prints these as sign extended. Sign extend value to 64 bits // now; without this it would get ZExt'd later in @@ -4634,11 +4626,19 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, DAG.getTargetConstant(Offset + ExtVal, SDLoc(C), MVT::i64)); return; } - if ((BA = dyn_cast<BlockAddressSDNode>(Op)) && ConstraintLetter != 'n') { - Ops.push_back(DAG.getTargetBlockAddress( - BA->getBlockAddress(), BA->getValueType(0), - Offset + BA->getOffset(), BA->getTargetFlags())); - return; + if (ConstraintLetter != 'n') { + if (const auto *GA = dyn_cast<GlobalAddressSDNode>(Op)) { + Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), SDLoc(Op), + GA->getValueType(0), + Offset + GA->getOffset())); + return; + } + if (const auto *BA = dyn_cast<BlockAddressSDNode>(Op)) { + Ops.push_back(DAG.getTargetBlockAddress( + BA->getBlockAddress(), BA->getValueType(0), + Offset + BA->getOffset(), BA->getTargetFlags())); + return; + } } const unsigned OpCode = Op.getOpcode(); if (OpCode == ISD::ADD || OpCode == ISD::SUB) { |