blob: 09e6e7db437a226a7a1a3ead2daa8230185e6e04 [file] [log] [blame]
Chris Lattner813fc422009-09-15 06:34:29 +00001; RUN: opt < %s -constprop -die -S | FileCheck %s
2
Rafael Espindola04594ae2012-01-27 23:33:07 +00003target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.7.2"
5
Chris Lattner7a2bdde2011-04-15 05:18:47 +00006; This is a basic sanity check for constant propagation. The add instruction
Chris Lattner4f538502002-05-03 20:12:31 +00007; should be eliminated.
Chris Lattner813fc422009-09-15 06:34:29 +00008define i32 @test1(i1 %B) {
Tanya Lattnerec9a35a2008-03-01 09:15:35 +00009 br i1 %B, label %BB1, label %BB2
10
Chris Lattner813fc422009-09-15 06:34:29 +000011BB1:
12 %Val = add i32 0, 0
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000013 br label %BB3
14
Chris Lattner813fc422009-09-15 06:34:29 +000015BB2:
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000016 br label %BB3
17
Chris Lattner813fc422009-09-15 06:34:29 +000018BB3:
19; CHECK: @test1
20; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ]
21 %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ]
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000022 ret i32 %Ret
Chris Lattner50e86822003-06-28 23:23:34 +000023}
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000024
Chris Lattnerb63127d2010-02-01 19:35:08 +000025
26; PR6197
27define i1 @test2(i8* %f) nounwind {
28entry:
29 %V = icmp ne i8* blockaddress(@test2, %bb), null
30 br label %bb
31bb:
32 ret i1 %V
33
34; CHECK: @test2
35; CHECK: ret i1 true
36}
Chandler Carruthf7b00472011-01-11 01:07:20 +000037
38define i1 @TNAN() {
39; CHECK: @TNAN
40; CHECK: ret i1 true
41 %A = fcmp uno double 0x7FF8000000000000, 1.000000e+00
42 %B = fcmp uno double 1.230000e+02, 1.000000e+00
43 %C = or i1 %A, %B
44 ret i1 %C
45}
Rafael Espindola04594ae2012-01-27 23:33:07 +000046
47define i128 @vector_to_int_cast() {
48 %A = bitcast <4 x i32> <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824> to i128
49 ret i128 %A
50; CHECK: @vector_to_int_cast
51; CHECK: ret i128 85070591750041656499021422275829170176
52}
53