1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 pr46052.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr46052.s > pr46052.ll
6 ; ModuleID = 'pr46052.s'
7 target 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 @a = common global [2 x i32] zeroinitializer, align 4
11 @i = common global i32 0, align 4
13 define void @foo(i32 %n) nounwind uwtable {
17 while.cond: ; preds = %while.body, %entry
18 %indvar = phi i32 [ %indvar.next, %while.body ], [ 0, %entry ]
19 %exitcond = icmp eq i32 %indvar, %n
20 br i1 %exitcond, label %while.end, label %while.body
22 while.body: ; preds = %while.cond
23 %call = call signext i8 @bar()
24 %conv = sext i8 %call to i32
25 %tmp1 = load i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 0), align 4
26 %xor = xor i32 %tmp1, %conv
27 store i32 %xor, i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 0), align 4
28 %call2 = call signext i8 @bar()
29 %conv3 = sext i8 %call2 to i32
30 %tmp4 = load i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 1), align 4
31 %xor5 = xor i32 %tmp4, %conv3
32 store i32 %xor5, i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 1), align 4
33 %indvar.next = add i32 %indvar, 1
36 while.end: ; preds = %while.cond
40 define internal signext i8 @bar() nounwind uwtable inlinehint {
42 %tmp = load i32* @i, align 4
43 %tobool = icmp eq i32 %tmp, 0
44 br i1 %tobool, label %cond.false, label %cond.true
46 cond.true: ; preds = %entry
47 %tmp1 = load i32* @i, align 4
48 %phitmp = trunc i32 %tmp1 to i8
51 cond.false: ; preds = %entry
54 cond.end: ; preds = %cond.false, %cond.true
55 %cond = phi i8 [ %phitmp, %cond.true ], [ 1, %cond.false ]
59 define void @foo1(i32 %n) nounwind uwtable {
63 while.cond: ; preds = %while.body, %entry
64 %indvar = phi i32 [ %indvar.next, %while.body ], [ 0, %entry ]
65 %exitcond = icmp eq i32 %indvar, %n
66 br i1 %exitcond, label %while.end, label %while.body
68 while.body: ; preds = %while.cond
69 %call = call signext i8 @bar1()
70 %conv = sext i8 %call to i32
71 %tmp1 = load i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 0), align 4
72 %xor = xor i32 %tmp1, %conv
73 store i32 %xor, i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 0), align 4
74 %call2 = call signext i8 @bar1()
75 %conv3 = sext i8 %call2 to i32
76 %tmp4 = load i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 1), align 4
77 %xor5 = xor i32 %tmp4, %conv3
78 store i32 %xor5, i32* getelementptr inbounds ([2 x i32]* @a, i64 0, i64 1), align 4
79 %indvar.next = add i32 %indvar, 1
82 while.end: ; preds = %while.cond
86 define internal signext i8 @bar1() nounwind uwtable inlinehint {