This is an archive of the discontinued LLVM Phabricator instance.

Preserve important metadata in JumpThreadingPass::unfoldSelectInstr
AbandonedPublic

Authored by mmendell on Jul 13 2023, 9:21 AM.

Details

Reviewers
rp
lattner
Summary

Useful metadata like llvm.loop can be lost when the new branch instruction is created. Grab that metadata from the old branch.
Add a LIT test to check

Diff Detail

Event Timeline

mmendell created this revision.Jul 13 2023, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 9:21 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
mmendell requested review of this revision.Jul 13 2023, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 9:21 AM
mmendell updated this revision to Diff 540093.Jul 13 2023, 9:57 AM

ran git clang-format

lattner resigned from this revision.Jul 13 2023, 1:56 PM

I'm sorry but I haven't worked on this code in a very long time.

@rp Could you please review this?

nikic added a subscriber: nikic.Jul 15 2023, 3:05 PM
nikic added inline comments.
llvm/test/Transforms/JumpThreading/preserve-select-unfold.ll
4

Use update_test_checks.py with --check-globals, remove data layout and triple.

11

The metadata you are testing for appear to already be present without your patch: https://llvm.godbolt.org/z/GqW8oo5fb

rp added a comment.EditedJul 17 2023, 3:05 AM

@rp Could you please review this?

Thanks for the trust, but the change preserving metadata during jump-threading was my first LLVM commit, so my review would not be worth much.

mmendell abandoned this revision.Jul 17 2023, 6:25 AM

I see that this is not needed any more. No idea why my version of LLVM has this problem....

llvm/test/Transforms/JumpThreading/preserve-select-unfold.ll
4

Actually, this was the wrong test case :-). It was supposed to be https://llvm.godbolt.org/z/GKzGzEr7o. On the other hand, it seems to be working as well. I was basing my change on an older LLVM. I am trying to bring it up to trunk.