mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-09 13:41:47 +00:00
520236e36f
Summary: This is last in of a series of patches to evolve ADCE.cpp to support removing of unnecessary control flow. This patch adds the code to update the control and data flow graphs to remove the dead control flow. Also update unit tests to test the capability to remove dead, may-be-infinite loop which is enabled by the switch -adce-remove-loops. Previous patches: D23824 [ADCE] Add handling of PHI nodes when removing control flow D23559 [ADCE] Add control dependence computation D23225 [ADCE] Modify data structures to support removing control flow D23065 [ADCE] Refactor anticipating new functionality (NFC) D23102 [ADCE] Refactoring for new functionality (NFC) Reviewers: dberlin, majnemer, nadav, mehdi_amini Subscribers: llvm-commits, david2050, freik, twoh Differential Revision: https://reviews.llvm.org/D24918 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289548 91177308-0d34-0410-b5e6-96231b3b80d8
21 lines
510 B
LLVM
21 lines
510 B
LLVM
; RUN: opt < %s -adce -simplifycfg -S | grep call
|
|
; RUN: opt < %s -adce -adce-remove-loops -simplifycfg -S | grep call
|
|
|
|
declare void @exit(i32)
|
|
|
|
define i32 @main(i32 %argc) {
|
|
%C = icmp eq i32 %argc, 1 ; <i1> [#uses=2]
|
|
br i1 %C, label %Cond, label %Done
|
|
|
|
Cond: ; preds = %0
|
|
br i1 %C, label %Loop, label %Done
|
|
|
|
Loop: ; preds = %Loop, %Cond
|
|
call void @exit( i32 0 )
|
|
br label %Loop
|
|
|
|
Done: ; preds = %Cond, %0
|
|
ret i32 1
|
|
}
|
|
|