This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Recognise some CCMPri
ClosedPublic

Authored by dmgreen on Aug 3 2022, 8:45 AM.

Details

Summary

This is a simple addition to emitConditionalComparison, to match CCMP with immediates using getIConstantVRegValWithLookThrough, letting it select the CCMPri variants of the instructions.

Diff Detail

Event Timeline

dmgreen created this revision.Aug 3 2022, 8:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 8:45 AM
dmgreen requested review of this revision.Aug 3 2022, 8:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 8:45 AM
paquette accepted this revision.Aug 3 2022, 9:55 AM

LGTM, thanks!

This revision is now accepted and ready to land.Aug 3 2022, 9:55 AM
This revision was landed with ongoing or failed builds.Aug 4 2022, 11:48 PM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.Aug 12 2022, 9:20 AM

Just a heads-up, we are seeing miscompiles that look to be caused by this patch. I'll try to share in isolated reproducer.

OK - feel free to revert. (I have no decent testing for GlobalISel yet).

Is it worth setting up a bot to police it?

fhahn added a comment.Aug 13 2022, 9:47 AM

OK - feel free to revert. (I have no decent testing for GlobalISel yet).

It turns out the mis-compile can also be reproduced by just bootstrapping LLVM with -O3 -fglobal-isel on AArch64 hardware. I reverted the change for now.

Is it worth setting up a bot to police it?

Yes definitely. It doesn't look like we have any buildbots covering GlobalISel on AArch64. I'll see if we can at least add a bootstrapping bot.

tschuett added inline comments.
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
4850

This condition is different from the one above? The C->Value.ult(32) differs.

It turns out the mis-compile can also be reproduced by just bootstrapping LLVM with -O3 -fglobal-isel on AArch64 hardware. I reverted the change for now.

I've tested a bootstrap and it worked with the new code. Please let me know if anything else seems broken.

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
4850

Yeah, that was pretty daft. It was intended to clear the C if it wasn't set to anything useful. I've changed it to a opcode check instead.

Considering there was a miscompile with this last time, I think there's probably a missing testcase. Could you add a test which covers the part that was broken last time?

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
4850

It'd be nice to have a comment here

The recommit in https://reviews.llvm.org/rG3c6edc0b2f812503a802bdd9c5842a0a9396b8c1 has a new test case and checks on the opcode, not the const.

Oh, good, thank you!