This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][NFC] Refactor creation of symbol+addend references
ClosedPublic

Authored by rafauler on Sep 16 2022, 6:34 PM.

Details

Summary

Put code that creates references to symbol+addend behind MCPlusBuilder.
Will use this later in validate memory references pass.

Diff Detail

Event Timeline

rafauler created this revision.Sep 16 2022, 6:34 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
rafauler requested review of this revision.Sep 16 2022, 6:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 6:34 PM
yota9 accepted this revision.Sep 17 2022, 11:17 AM

Thanks for the refactoring!

bolt/lib/Core/BinaryFunction.cpp
1054

Maybe change assert to if + exit ?

This revision is now accepted and ready to land.Sep 17 2022, 11:17 AM
rafauler added inline comments.Sep 19 2022, 2:10 PM
bolt/lib/Core/BinaryFunction.cpp
1054

Are we migrating away from assertions? This is not supposed to fail at all, unless we modify our codebase in weird ways, so I would like to assert here. But I'm not sure how hard are people trying to get rid of assertions.

Another reason this might fail is if somebody is writing a new backend and fails to replace the memory operand of a given instruction that they need to support replacing.

maksfb accepted this revision.Oct 7 2022, 3:21 PM

Add "[BOLT]" to the title. Replace "this code" in the Summary with the description of the code. Otherwise LGTM.

bolt/lib/Core/BinaryFunction.cpp
1054

It it's a validation of internal assumptions, not an assumption about the input, then it should be an assertion.

1054
rafauler retitled this revision from [NFC] Refactor creation of symbol+addend references to [BOLT][NFC] Refactor creation of symbol+addend references.Oct 10 2022, 5:22 PM
rafauler edited the summary of this revision. (Show Details)

Thanks all

bolt/lib/Core/BinaryFunction.cpp
1054

I don't follow this change, assertions (at least in this file) follow lower case messages with no period. Am I missing something?

maksfb added inline comments.Oct 10 2022, 11:14 PM
bolt/lib/Core/BinaryFunction.cpp
1054

You are right about the existing assertions. The idea is to move toward LLVM standard in messages and assertions, hence the suggestion.

rafauler updated this revision to Diff 467298.Oct 12 2022, 4:41 PM

Updating assertion message