This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] AArch64CondBrTuningPass generates wrong branch instructions
ClosedPublic

Authored by labrinea on Jun 28 2017, 1:45 AM.

Details

Summary

Some conditional branch instructions generated by this pass are checking the wrong condition code. The instructions TBZ and TBNZ are transformed into B.GE and B.LT instead of B.PL and B.MI respectively. They should only be checking the Negative bit.

Diff Detail

Event Timeline

labrinea created this revision.Jun 28 2017, 1:45 AM
gberry accepted this revision.Jun 28 2017, 7:02 AM

Good catch. @mcrosier These test could probably be improved a little by making clear which way the branch was going by checking for the store instruction before the ret.

This revision is now accepted and ready to land.Jun 28 2017, 7:02 AM
gberry added inline comments.Jun 28 2017, 7:12 AM
lib/Target/AArch64/AArch64CondBrTuning.cpp
25

This comment should be fixed.

This revision was automatically updated to reflect the committed changes.
mcrosier edited edge metadata.Jun 28 2017, 11:01 AM

Thanks for the fix, Alexandros!

I'll improve the test cases shortly, Geoff.

lib/Target/AArch64/AArch64CondBrTuning.cpp
25

I'll update this shortly.