This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Don't form "ands" when it isn't scheduled correctly.
ClosedPublic

Authored by efriedma on Mar 21 2019, 5:27 PM.

Details

Summary

In r322972/r323136, the iteration here was changed to catch cases at the beginning of a basic block... but we accidentally deleted an important safety check. Restore that check to the way it was.

Fixes https://bugs.llvm.org/show_bug.cgi?id=41116

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Mar 21 2019, 5:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2019, 5:27 PM
dmgreen accepted this revision.Mar 22 2019, 4:56 AM

LGTM, thanks for putting the fix together.

If I understand correctly, if cpsr was not used between the TST and the AND, this would be OK to remove. Do you know if the isSafe loop could/should catch this? This whole function mostly expects the CmpMI to be after MI, so I think this fix is a good one in any case.

This revision is now accepted and ready to land.Mar 22 2019, 4:56 AM

if cpsr was not used between the TST and the AND, this would be OK to remove

Yes. But rescheduling would be more general and simpler to implement, I think. Given the conditions here, it should be easy to prove the ANDri is safe to hoist.

This revision was automatically updated to reflect the committed changes.