[PATCH] D17548: AMDGPU: Check cheaper condition before SignBitIsZero
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 11:17:57 PST 2016
arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.
Don't do an expensive computeKnownBits call when we
can do the cheap check for legal offsets first.
http://reviews.llvm.org/D17548
Files:
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
Index: lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -1063,14 +1063,13 @@
if (CurDAG->isBaseWithConstantOffset(Addr)) {
SDValue N0 = Addr.getOperand(0);
SDValue N1 = Addr.getOperand(1);
+
// Offsets in vaddr must be positive.
- if (CurDAG->SignBitIsZero(N0)) {
- ConstantSDNode *C1 = cast<ConstantSDNode>(N1);
- if (isLegalMUBUFImmOffset(C1)) {
- VAddr = N0;
- ImmOffset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i16);
- return true;
- }
+ ConstantSDNode *C1 = cast<ConstantSDNode>(N1);
+ if (isLegalMUBUFImmOffset(C1) && CurDAG->SignBitIsZero(N0)) {
+ VAddr = N0;
+ ImmOffset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i16);
+ return true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17548.48841.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160223/e0a81636/attachment.bin>
More information about the llvm-commits
mailing list