This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix a bug with jump table generation
ClosedPublic

Authored by david-arm on Nov 21 2019, 4:55 AM.

Details

Summary

When trying to calculate the offsets for the jump table entries
we fail to take into account the block alignment, which could be
greater than 4 bytes. This led to cases where the jump table
offset was too big to fit in a byte.

Diff Detail

Event Timeline

david-arm created this revision.Nov 21 2019, 4:55 AM
ostannard requested changes to this revision.Dec 2 2019, 9:40 AM
ostannard added a subscriber: ostannard.
ostannard added inline comments.
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
324–325

This isn't handled in valueFitsIntoFixupKind, and probably shouldn't hit the default of true if Value is non-zero.

331

This should be the LLVM_FALLTHROUGH macro to suppress compiler warnings.

This revision now requires changes to proceed.Dec 2 2019, 9:40 AM
david-arm updated this revision to Diff 232296.Dec 5 2019, 3:30 AM

Done the changes requested by Oliver Stannard

david-arm marked 2 inline comments as done.Dec 5 2019, 3:30 AM
This revision is now accepted and ready to land.Dec 6 2019, 4:00 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.Sep 22 2020, 6:06 AM
fhahn added inline comments.
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
330

It appears like this error unfortunately can also be triggered by valid LLVM IR. @t.p.northover put up a patch to remove the error D88085. I am not sure if there is a more targeted way to only detect transforms in the backend that result in invalid overflows.