This is an archive of the discontinued LLVM Phabricator instance.

[Passes] Fix relative lookup table converter pass
ClosedPublic

Authored by gulfem on Dec 10 2021, 7:35 PM.

Details

Summary

This patch fixes the relative table converter pass for the lookup table
accesses that are resulted in an instruction sequence, where gep is not
immediately followed by a load, such as gep being hoisted outside the loop
or another instruction is inserted in between them. The fix inserts the
call to load.relative.instrinsic in the original place of load instead of gep.
Issue is reported by FreeBSD via https://bugs.freebsd.org/259921.

Diff Detail

Event Timeline

gulfem created this revision.Dec 10 2021, 7:35 PM
gulfem requested review of this revision.Dec 10 2021, 7:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2021, 7:35 PM
lebedev.ri accepted this revision.Dec 11 2021, 12:24 AM
lebedev.ri added a subscriber: lebedev.ri.

LGTM, thank you, the fix is straight-forward.

llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
149
This revision is now accepted and ready to land.Dec 11 2021, 12:24 AM
jrtc27 accepted this revision.Dec 11 2021, 9:14 AM

Thanks

This revision was automatically updated to reflect the committed changes.