This is an archive of the discontinued LLVM Phabricator instance.

[ARM][LowOverheadLoops] Correct offset checking
ClosedPublic

Authored by samparker on Jul 10 2019, 8:18 AM.

Details

Summary

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 isBBInRange checks both positive and negative offsets. ARMISelLowering has been tweaked because the test case presented another pattern that wasn't supported.

Diff Detail

Event Timeline

samparker created this revision.Jul 10 2019, 8:18 AM
SjoerdMeijer added inline comments.Jul 10 2019, 8:36 AM
lib/Target/ARM/ARMISelLowering.cpp
12996

just a nit, perhaps it reads easier if this is just this instead of a nested if:

if ((...XOR || ...SETCC) && CC->getOperand(0)->getOpcode() == ISD::INTRINSIC_W_CHAIN)
lib/Target/ARM/ARMLowOverheadLoops.cpp
211

I am wondering why here the opcode is checked (WLS), but why that is not necessary above for LE....

samparker marked an inline comment as done.Jul 11 2019, 12:19 AM
samparker added inline comments.
lib/Target/ARM/ARMLowOverheadLoops.cpp
211

Because 'End' can only be LE, whereas 'Start' can be DLS or WLS, and DLS doesn't use an offset.

Modified logic during lowering.

SjoerdMeijer accepted this revision.Jul 11 2019, 1:31 AM

Looks like a good fix to me.

lib/Target/ARM/ARMLowOverheadLoops.cpp
211

Ah, of course, cheers.

This revision is now accepted and ready to land.Jul 11 2019, 1:31 AM
samparker closed this revision.Jul 11 2019, 2:56 AM

Committed in rL365749.