blob: 14580c1eab288787ce99b1edc877deb2aff2025a [file] [log] [blame]
Chris Lattner813fc422009-09-15 06:34:29 +00001; RUN: opt < %s -constprop -die -S | FileCheck %s
2
Chris Lattner4f538502002-05-03 20:12:31 +00003; This is a basic sanity check for constant propogation. The add instruction
4; should be eliminated.
Chris Lattner813fc422009-09-15 06:34:29 +00005define i32 @test1(i1 %B) {
Tanya Lattnerec9a35a2008-03-01 09:15:35 +00006 br i1 %B, label %BB1, label %BB2
7
Chris Lattner813fc422009-09-15 06:34:29 +00008BB1:
9 %Val = add i32 0, 0
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000010 br label %BB3
11
Chris Lattner813fc422009-09-15 06:34:29 +000012BB2:
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000013 br label %BB3
14
Chris Lattner813fc422009-09-15 06:34:29 +000015BB3:
16; CHECK: @test1
17; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ]
18 %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ]
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000019 ret i32 %Ret
Chris Lattner50e86822003-06-28 23:23:34 +000020}
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000021
Chris Lattnerb63127d2010-02-01 19:35:08 +000022
23; PR6197
24define i1 @test2(i8* %f) nounwind {
25entry:
26 %V = icmp ne i8* blockaddress(@test2, %bb), null
27 br label %bb
28bb:
29 ret i1 %V
30
31; CHECK: @test2
32; CHECK: ret i1 true
33}