[llvm] r318017 - AMDGPU: Preserve nuw in shl add ptr combine
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 12 21:33:35 PST 2017
Author: arsenm
Date: Sun Nov 12 21:33:35 2017
New Revision: 318017
URL: http://llvm.org/viewvc/llvm-project?rev=318017&view=rev
Log:
AMDGPU: Preserve nuw in shl add ptr combine
Modified:
llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=318017&r1=318016&r2=318017&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Sun Nov 12 21:33:35 2017
@@ -5229,7 +5229,12 @@ SDValue SITargetLowering::performSHLPtrC
SDValue ShlX = DAG.getNode(ISD::SHL, SL, VT, N0.getOperand(0), N1);
SDValue COffset = DAG.getConstant(Offset, SL, MVT::i32);
- return DAG.getNode(ISD::ADD, SL, VT, ShlX, COffset);
+ SDNodeFlags Flags;
+ Flags.setNoUnsignedWrap(N->getFlags().hasNoUnsignedWrap() &&
+ (N0.getOpcode() == ISD::OR ||
+ N0->getFlags().hasNoUnsignedWrap()));
+
+ return DAG.getNode(ISD::ADD, SL, VT, ShlX, COffset, Flags);
}
SDValue SITargetLowering::performMemSDNodeCombine(MemSDNode *N,
More information about the llvm-commits
mailing list