aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorDianQK <dianqk@dianqk.net>2023-09-19 17:57:30 +0800
committerDianQK <dianqk@dianqk.net>2023-09-20 07:21:49 +0800
commit96ea48ff5dcba46af350f5300eafd7f7394ba606 (patch)
tree5197a2e50cc98a47c7b73696de3ccd3313385e35 /llvm/lib/IR/Module.cpp
parent40b0ab287f9f5c58fa35a9a97cc49f104bef45ed (diff)
downloadllvm-96ea48ff5dcba46af350f5300eafd7f7394ba606.zip
llvm-96ea48ff5dcba46af350f5300eafd7f7394ba606.tar.gz
llvm-96ea48ff5dcba46af350f5300eafd7f7394ba606.tar.bz2
[SimplifyCFG] Hoist common instructions on Switch.
Sink common instructions are not always performance friendly. We need to implement hoist common instructions on switch instruction to solve the following problem: ``` define i1 @foo(i64 %a, i64 %b, i64 %c, i64 %d) { start: %test = icmp eq i64 %a, %d br i1 %test, label %switch_bb, label %exit switch_bb: ; preds = %start switch i64 %a, label %bb0 [ i64 1, label %bb1 i64 2, label %bb2 ] bb0: ; preds = %switch_bb %0 = icmp eq i64 %b, %c br label %exit bb1: ; preds = %switch_bb %1 = icmp eq i64 %b, %c br label %exit bb2: ; preds = %switch_bb %2 = icmp eq i64 %b, %c br label %exit exit: ; preds = %bb2, %bb1, %bb0, %start %result = phi i1 [ false, %start ], [ %0, %bb0 ], [ %1, %bb1 ], [ %2, %bb2 ] ret i1 %result } ``` The pre-commit test is D156617. Reviewed By: XChy, nikic Differential Revision: https://reviews.llvm.org/D155711
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions