1 ; RUN: opt -O3 -S < %s | FileCheck %s
3 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"
4 target triple = "x86_64-apple-macosx10.6.7"
6 declare i8* @malloc(i64)
7 declare void @free(i8*)
11 define void @test1() nounwind ssp {
12 %retval = alloca i32, align 4
13 %i = alloca i8*, align 8
14 %call = call i8* @malloc(i64 1)
15 store i8* %call, i8** %i, align 8
16 %tmp = load i8*, i8** %i, align 8
18 %tmp1 = load i8*, i8** %i, align 8
19 call void @free(i8* %tmp1)
22 ; CHECK-LABEL: @test1(
23 ; CHECK-NEXT: ret void
26 ; This function exposes a phase ordering problem when InstCombine is
27 ; turning %add into a bitmask, making it difficult to spot a 0 return value.
29 ; It it also important that %add is expressed as a multiple of %div so scalar
30 ; evolution can recognize it.
31 define i32 @test2(i32 %a, i32* %p) nounwind uwtable ssp {
34 %arrayidx = getelementptr inbounds i32, i32* %p, i64 0
35 store i32 %div, i32* %arrayidx, align 4
36 %add = add i32 %div, %div
37 %arrayidx1 = getelementptr inbounds i32, i32* %p, i64 1
38 store i32 %add, i32* %arrayidx1, align 4
39 %arrayidx2 = getelementptr inbounds i32, i32* %p, i64 1
40 %0 = load i32, i32* %arrayidx2, align 4
41 %arrayidx3 = getelementptr inbounds i32, i32* %p, i64 0
42 %1 = load i32, i32* %arrayidx3, align 4
44 %sub = sub i32 %0, %mul
47 ; CHECK-LABEL: @test2(
48 ; CHECK: %div = lshr i32 %a, 2
49 ; CHECK: %add = shl nuw nsw i32 %div, 1