This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG][NFC] Add tests for merging the combination of phis in switch
ClosedPublic

Authored by XChy on Jul 21 2023, 3:49 AM.

Details

Summary

Tests for an upcoming simplification to merge the combination of phis in switch.
Related issue:
Switch not fully optimized

Diff Detail

Event Timeline

XChy created this revision.Jul 21 2023, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 3:49 AM
XChy requested review of this revision.Jul 21 2023, 3:49 AM
XChy updated this revision to Diff 542859.Jul 21 2023, 4:17 AM
XChy updated this revision to Diff 542906.Jul 21 2023, 7:22 AM
XChy set the repository for this revision to rG LLVM Github Monorepo.
  • Avoid infinite loops
XChy updated this revision to Diff 542907.Jul 21 2023, 7:23 AM
DianQK added inline comments.Jul 21 2023, 8:39 PM
llvm/test/Transforms/SimplifyCFG/merge-phis-in-switch.ll
73

Is the %unreachable necessary?
https://llvm.godbolt.org/z/cfj7Y8nnd

XChy marked an inline comment as done.Jul 21 2023, 9:52 PM
XChy added inline comments.
llvm/test/Transforms/SimplifyCFG/merge-phis-in-switch.ll
73

Not necessary for merging phis. But only with unreachable can we fold it into add i8 %arg, 1 through lookup table optimization.

DianQK added inline comments.Jul 21 2023, 10:07 PM
llvm/test/Transforms/SimplifyCFG/merge-phis-in-switch.ll
73

Oh, you're right.

XChy updated this revision to Diff 545350.Jul 29 2023, 2:07 AM
XChy marked an inline comment as done.

Add test for generalization.

XChy accepted this revision.Sep 24 2023, 7:18 PM
This revision is now accepted and ready to land.Sep 24 2023, 7:18 PM
XChy closed this revision.Sep 24 2023, 7:18 PM