1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll
David Callahan 86eb682529 [ADCE] Add code to remove dead branches
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

llvm-svn: 289548
2016-12-13 16:42:18 +00:00

30 lines
927 B
LLVM

; RUN: opt < %s -adce -disable-output
; RUN: opt < %s -adce -adce-remove-loops -disable-output
@G = external global i32* ; <i32**> [#uses=1]
declare void @Fn(i32*)
define i32 @main(i32 %argc.1, i8** %argv.1) {
entry:
br label %endif.42
endif.42: ; preds = %shortcirc_done.12, %then.66, %endif.42, %entry
br i1 false, label %endif.65, label %endif.42
then.66: ; preds = %shortcirc_done.12
call void @Fn( i32* %tmp.2846 )
br label %endif.42
endif.65: ; preds = %endif.42
%tmp.2846 = load i32*, i32** @G ; <i32*> [#uses=1]
br i1 false, label %shortcirc_next.12, label %shortcirc_done.12
shortcirc_next.12: ; preds = %endif.65
br label %shortcirc_done.12
shortcirc_done.12: ; preds = %shortcirc_next.12, %endif.65
br i1 false, label %then.66, label %endif.42
}