This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix Thumb2 compare being emitted ExpandCMP_SWAP
ClosedPublic

Authored by dmgreen on Jul 13 2022, 2:09 PM.

Details

Summary

Given a patch like D129506, using instructions not valid for the current target feature set becomes an error. This fixes an issue in ARMExpandPseudo::ExpandCMP_SWAP where Thumb2 compares were used in Thumb1Only code, such as thumbv8m.baseline targets.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 13 2022, 2:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 2:09 PM
dmgreen requested review of this revision.Jul 13 2022, 2:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 2:09 PM

Is there some rule that ensures TempReg is a low register? I guess the register allocator for thumbv8m.baseline currently doesn't choose high registers, but that's sort of fragile. I'd prefer to make the pseudo-instruction explicitly constrain the register class if that's necessary.

llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
1853

strexd doesn't exist in thumbv8m.baseline?

dmgreen updated this revision to Diff 445402.Jul 18 2022, 12:30 AM

This now adds a tCMP_SWAP_32 and uses tGPR for the tmp reg. The 64bit version was changes to an assert.

This revision is now accepted and ready to land.Jul 18 2022, 11:13 AM
This revision was landed with ongoing or failed builds.Jul 20 2022, 4:04 AM
This revision was automatically updated to reflect the committed changes.