1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/branch-phi-thread.ll
David Blaikie ab043ff680 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
Essentially the same as the GEP change in r230786.

A similar migration script can be used to update test cases, though a few more
test case improvements/changes were required this time around: (r229269-r229278)

import fileinput
import sys
import re

pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)")

for line in sys.stdin:
  sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line))

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7649

llvm-svn: 230794
2015-02-27 21:17:42 +00:00

67 lines
1.3 KiB
LLVM

; RUN: opt < %s -simplifycfg -adce -S | \
; RUN: not grep "call void @f1"
; END.
declare void @f1()
declare void @f2()
declare void @f3()
declare void @f4()
define i32 @test1(i32 %X, i1 %D) {
E:
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
br i1 %C, label %T, label %F
T: ; preds = %A, %E
br i1 %C, label %B, label %A
A: ; preds = %T
call void @f1( )
br i1 %D, label %T, label %F
B: ; preds = %T
call void @f2( )
ret i32 345
F: ; preds = %A, %E
call void @f3( )
ret i32 123
}
define i32 @test2(i32 %X, i1 %D) {
E:
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
br i1 %C, label %T, label %F
T: ; preds = %A, %E
%P = phi i1 [ true, %E ], [ %C, %A ] ; <i1> [#uses=1]
br i1 %P, label %B, label %A
A: ; preds = %T
call void @f1( )
br i1 %D, label %T, label %F
B: ; preds = %T
call void @f2( )
ret i32 345
F: ; preds = %A, %E
call void @f3( )
ret i32 123
}
define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
E:
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
br i1 %C, label %T, label %F
T: ; preds = %A, %E
call void @f3( )
%XX = load i32, i32* %AP ; <i32> [#uses=1]
store i32 %XX, i32* %BP
br i1 %C, label %B, label %A
A: ; preds = %T
call void @f1( )
br i1 %D, label %T, label %F
B: ; preds = %T
call void @f2( )
ret i32 345
F: ; preds = %A, %E
call void @f3( )
ret i32 123
}