diff options
| author | Sam Parker <sam.parker@arm.com> | 2019-07-11 09:56:15 +0000 |
|---|---|---|
| committer | Sam Parker <sam.parker@arm.com> | 2019-07-11 09:56:15 +0000 |
| commit | 08b4a8da07aa2335c44a40aa5a9951c2ee909e6b (patch) | |
| tree | c8b0d7b8083cf8ede5d20306a2022f362f635418 /llvm/lib/Target/ARM/ARMISelLowering.cpp | |
| parent | ad54935c7781008d3ad780767aec309f28360ff9 (diff) | |
| download | bcm5719-llvm-08b4a8da07aa2335c44a40aa5a9951c2ee909e6b.tar.gz bcm5719-llvm-08b4a8da07aa2335c44a40aa5a9951c2ee909e6b.zip | |
[ARM][LowOverheadLoops] Correct offset checking
This patch addresses a couple of problems:
1) The maximum supported offset of LE is -4094.
2) The offset of WLS also needs to be checked, this uses a
maximum positive offset of 4094.
The use of BasicBlockUtils has been changed because the block offsets
weren't being initialised, but the isBBInRange checks both positive
and negative offsets.
ARMISelLowering has been tweaked because the test case presented
another pattern that we weren't supporting.
llvm-svn: 365749
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 36b669b8526..dd11ed6ede7 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -12989,22 +12989,26 @@ static SDValue PerformHWLoopCombine(SDNode *N, const ARMSubtarget *ST) { // Look for (brcond (xor test.set.loop.iterations, -1) SDValue CC = N->getOperand(1); + unsigned Opc = CC->getOpcode(); + SDValue Int; - if (CC->getOpcode() != ISD::XOR && CC->getOpcode() != ISD::SETCC) - return SDValue(); + if ((Opc == ISD::XOR || Opc == ISD::SETCC) && + (CC->getOperand(0)->getOpcode() == ISD::INTRINSIC_W_CHAIN)) { + + assert((isa<ConstantSDNode>(CC->getOperand(1)) && + cast<ConstantSDNode>(CC->getOperand(1))->isOne()) && + "Expected to compare against 1"); - if (CC->getOperand(0)->getOpcode() != ISD::INTRINSIC_W_CHAIN) + Int = CC->getOperand(0); + } else if (CC->getOpcode() == ISD::INTRINSIC_W_CHAIN) + Int = CC; + else return SDValue(); - SDValue Int = CC->getOperand(0); unsigned IntOp = cast<ConstantSDNode>(Int.getOperand(1))->getZExtValue(); if (IntOp != Intrinsic::test_set_loop_iterations) return SDValue(); - assert((isa<ConstantSDNode>(CC->getOperand(1)) && - cast<ConstantSDNode>(CC->getOperand(1))->isOne()) && - "Expected to compare against 1"); - SDLoc dl(Int); SDValue Chain = N->getOperand(0); SDValue Elements = Int.getOperand(2); |

