summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AMDGPU/SIISelLowering.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 12d0bc528ca..894806b9faa 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -6005,11 +6005,13 @@ std::pair<SDValue, SDValue> SITargetLowering::splitBufferOffsets(
const unsigned MaxImm = 4095;
SDValue N0 = Offset;
ConstantSDNode *C1 = nullptr;
- if (N0.getOpcode() == ISD::ADD) {
- if ((C1 = dyn_cast<ConstantSDNode>(N0.getOperand(1))))
- N0 = N0.getOperand(0);
- } else if ((C1 = dyn_cast<ConstantSDNode>(N0)))
+
+ if ((C1 = dyn_cast<ConstantSDNode>(N0)))
N0 = SDValue();
+ else if (DAG.isBaseWithConstantOffset(N0)) {
+ C1 = cast<ConstantSDNode>(N0.getOperand(1));
+ N0 = N0.getOperand(0);
+ }
if (C1) {
unsigned ImmOffset = C1->getZExtValue();
OpenPOWER on IntegriCloud