This is an archive of the discontinued LLVM Phabricator instance.

[Thumb1] The recently added tADCS and tSBCS pseudo-instructions were missing `Uses = [CPSR]`
ClosedPublic

Authored by tyomitch on Apr 7 2017, 10:04 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

tyomitch created this revision.Apr 7 2017, 10:04 AM
efriedma added inline comments.Apr 7 2017, 2:35 PM
test/CodeGen/Thumb/long.ll
234 ↗(On Diff #94540)

Please write an MIR testcase; it's difficult to understand what this is testing.

tyomitch added inline comments.Apr 10 2017, 12:15 AM
test/CodeGen/Thumb/long.ll
234 ↗(On Diff #94540)

The issue in this case was that the missing implicit-use of CPSR on tADCS led to the last tADDi8 being treated as dead, and eliminated (apparently by TwoAddressInstructionPass). The pass itself was doing everything right, it's just that its input was wrong.

I'm not sure what kind of MIR would make this test case easier to understand.

efriedma added inline comments.Apr 10 2017, 11:21 AM
test/CodeGen/Thumb/long.ll
234 ↗(On Diff #94540)

For someone reading it, it isn't obvious why we're generating adcs in the first place (and if we improve constant hoisting at some point to split 64-bit constants, the adcs will go away). So I'd prefer an MIR test checking that TwoAddressInstructionPass or whatever isn't eliminating the tADDi8.

If you'd prefer to stick with an IR test, please change it so it doesn't depend on constant hoisting.

tyomitch updated this revision to Diff 95989.Apr 20 2017, 11:24 AM

Sorry for the long delay! Test case updated to make the long adds explicit, and not depend on constant hoisting.

efriedma accepted this revision.Apr 20 2017, 12:52 PM

LGTM, with one minor comment.

test/CodeGen/Thumb/long.ll
229 ↗(On Diff #95989)

"; CHECK-NEXT: adcs", so nothing slips between.

This revision is now accepted and ready to land.Apr 20 2017, 12:52 PM
tyomitch added inline comments.Apr 21 2017, 12:17 AM
test/CodeGen/Thumb/long.ll
229 ↗(On Diff #95989)

There's actually push {r4}; pop {r1} between these two; but the other two aren't separated, so I'll change the other CHECK: adcs to CHECK-NEXT.

This revision was automatically updated to reflect the committed changes.