This is an archive of the discontinued LLVM Phabricator instance.

[Lanai] fix MC / objdump
ClosedPublic

Authored by q3k on Aug 5 2021, 12:31 PM.

Details

Summary

D78776 removed is{Call,Branch,UnconditionalBranch} guards in objdump
before calling MCInstrAnalysis::evaluateBranch. This is fine for other
architectures as they gracefully handle evaluateBranch being called on
non-branches. However, the Lanai MCInstrAnalysis implementation didn't
and that change caused it to crash.

This inserts the same guards back into Lanai's evaluateBranch
implementation and adds a smoke test that exercises llc | objdump so
this kind of regression is hopefully caught next time.

Diff Detail

Event Timeline

q3k created this revision.Aug 5 2021, 12:31 PM
q3k requested review of this revision.Aug 5 2021, 12:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2021, 12:31 PM
jpienaar accepted this revision.Aug 9 2021, 9:59 AM

Thanks!

llvm/test/tools/llvm-objdump/ELF/Lanai/smoketest.ll
4 ↗(On Diff #364579)

s/in to/to/ ?

This revision is now accepted and ready to land.Aug 9 2021, 9:59 AM
MaskRay added inline comments.Aug 9 2021, 10:43 AM
llvm/test/tools/llvm-objdump/ELF/Lanai/smoketest.ll
1 ↗(On Diff #364579)

; RUN

5 ↗(On Diff #364579)

Tests in binary utility directories typically use ;; for non-CHECK-non-RUN comments.

q3k updated this revision to Diff 371637.Sep 9 2021, 9:48 AM
q3k marked 3 inline comments as done.

Address review comments.

q3k added a comment.Sep 9 2021, 9:49 AM

Sorry for the delay, @MaskRay, please take a look now.

You may remove test from the filename. The leading test path component says these are tests.

llvm/test/tools/llvm-objdump/ELF/Lanai/smoketest.ll
1 ↗(On Diff #371637)

delete excess spaces between llc and -o

I usually prefer %t.bc for bitcode output

2 ↗(On Diff #371637)
q3k updated this revision to Diff 371641.Sep 9 2021, 10:04 AM
q3k marked an inline comment as done.

Another review comment round.

q3k marked an inline comment as done.Sep 9 2021, 10:06 AM
MaskRay accepted this revision.Sep 9 2021, 10:17 AM
This revision was automatically updated to reflect the committed changes.