This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Size reduce teq to eors
ClosedPublic

Authored by samparker on Jan 3 2019, 3:22 AM.

Details

Summary

Add t2TEQrr to the map of instructions with can be reduced down into a T1 instruction. This is a special case because TEQ just sets the CPSR and doesn't write to a GPR, which is not the case for EOR. So, we need to ensure that the EOR can write to the first operand.

Diff Detail

Event Timeline

samparker created this revision.Jan 3 2019, 3:22 AM

This looks fine to me, but it's the first time I look at this file and table. Perhaps @dmgreen or @efriedma can have a look too.

Question about thumb2-teq2.ll, why is the other test case f2 not affected by this change?

Perhaps we add a MIR test? To test this more directly.

@SjoerdMeijer good point.... and it actually does and somehow i just haven't updated the test correctly.
@dmgreen yes, good idea.

samparker updated this revision to Diff 180473.Jan 7 2019, 5:53 AM
  • corrected original teq test
  • added mir test

Now that we have MIR tests, do we still need the added .ll test?

The mir test isn't producing the IT block, and I'm unsure why and how to get this to work. That's why I've only included the first test which is to check the IT block.

SjoerdMeijer accepted this revision.Jan 8 2019, 2:11 AM

Thanks, looks okay to me. Perhaps wait a day with committing to give people one more chance to comment.

This revision is now accepted and ready to land.Jan 8 2019, 2:11 AM

The mir test isn't producing the IT block, and I'm unsure why and how to get this to work

Run your IR testcase with "llc -stop-before=unpack-mi-bundles"; that should give you MIR in the form the second run of Thumb2SizeReduction will see it.

lib/Target/ARM/Thumb2SizeReduction.cpp
924

Maybe also setIsDead(true)? Probably doesn't make much difference this late, but probably better to be consistent.

samparker updated this revision to Diff 180803.Jan 9 2019, 1:51 AM

Thanks Eli, I've updated the test case and set isDead.

This revision was automatically updated to reflect the committed changes.