This is an archive of the discontinued LLVM Phabricator instance.

[MC][MachO]Do not emit DWARF for no-personality case
ClosedPublic

Authored by oontvoo on Jun 9 2023, 7:37 AM.

Details

Summary

Detail: Follow up to D144999, where we emitted DWARF for non-canonical personality.

Diff Detail

Event Timeline

oontvoo created this revision.Jun 9 2023, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 7:37 AM
oontvoo requested review of this revision.Jun 9 2023, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 7:37 AM
oontvoo retitled this revision from f1;95;0c[MC][MachO]Do not emit DWARF for no-personality case to [MC][MachO]Do not emit DWARF for no-personality case.Jun 9 2023, 8:02 AM
jyknight accepted this revision.Jun 9 2023, 10:36 AM
jyknight added inline comments.
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
572

Move the change into the isDarwinCanonicalPersonality function?

This revision is now accepted and ready to land.Jun 9 2023, 10:36 AM
oontvoo updated this revision to Diff 530017.Jun 9 2023, 10:37 AM

make checks more strict.

oontvoo updated this revision to Diff 530018.Jun 9 2023, 10:38 AM

make checks stricter

oontvoo added inline comments.Jun 9 2023, 10:51 AM
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
572

well, both of these two predicates are *already* in the function. (it is supposed to tell you if a given symbol is a canonical-darwin personality.)
BUT if it returns false, then it could be any of the following reason:

  • (1) the symbol is NULL
  • (2) the symbol is NOT MachO
  • (3) the symbol is NOT canonical personality symbol.

We only want to return DWARF-MODE here for reason number (3)

If we want to reuse a util function, then we ought to name it isNonNullDarwinNonCanonicalPersonality...
That's a bit hard to read.

jyknight added inline comments.Jun 9 2023, 11:23 AM
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
572

I'd say the util function should return true for NULL, because NULL is a canonical personality (it's always given index 0, right?)

How do you even get a !MachO symbol in here -- all of this is Mach-O-specific, right? Perhaps can just remove that clause?

oontvoo updated this revision to Diff 530034.Jun 9 2023, 11:38 AM

addressed review comments

oontvoo marked an inline comment as not done.Jun 9 2023, 11:39 AM
oontvoo added inline comments.
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
572

Good point.
I've updated the function and replace the isMachO check with just an assert instead. (who knows?!)

tschuett added inline comments.
llvm/lib/MC/MCAsmBackend.cpp
125 ↗(On Diff #530035)

Could you please turn the assert into an if-statement?

jyknight added inline comments.Jun 9 2023, 2:10 PM
llvm/lib/MC/MCAsmBackend.cpp
125 ↗(On Diff #530035)

Can you please clarify the purpose of your request? Refer to previous discussion thread here as to why this was changed, and if you disagree, please explain why.

tschuett added inline comments.Jun 9 2023, 8:55 PM
llvm/lib/MC/MCAsmBackend.cpp
125 ↗(On Diff #530035)

In release mode, the assert cannot fire. It is useless. It only helps you during development.

oontvoo updated this revision to Diff 530469.Jun 12 2023, 5:21 AM
oontvoo marked 3 inline comments as done.

updated patch

llvm/lib/MC/MCAsmBackend.cpp
125 ↗(On Diff #530035)

This assert is mostly a smoke-check for (most likely) impossible scenario - supposed to help in development only. So I'd have thought an assert is appropriate. Besides, there are plenty of other places both in this file and this package that use 'assert'. I'm not sure how those are different from this instance.

But anyways, changed to llvm_unreachable.

This revision was landed with ongoing or failed builds.Jun 12 2023, 6:37 AM
This revision was automatically updated to reflect the committed changes.