brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 1db1d7e Raw
42 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2 3target 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"4target triple = "x86_64-apple-darwin10.0"5 6declare noalias ptr @malloc(i64) nounwind allockind("alloc,uninitialized") "alloc-family"="malloc"7declare void @free(ptr) allockind("free") "alloc-family"="malloc"8 9; PR513010define i1 @test1() {11  %A = call noalias ptr @malloc(i64 4) nounwind12  %B = icmp eq ptr %A, null13  store i8 0, ptr %A14 15  call void @free(ptr %A)16  ret i1 %B17 18; CHECK-LABEL: @test1(19; CHECK: ret i1 false20}21 22; CHECK-LABEL: @test2(23define noalias ptr @test2() nounwind {24entry:25; CHECK: @malloc26  %A = call noalias ptr @malloc(i64 4) nounwind27; CHECK: icmp eq28  %tobool = icmp eq ptr %A, null29; CHECK: br i130  br i1 %tobool, label %return, label %if.end31 32if.end:33; CHECK: store34  store i8 7, ptr %A35  br label %return36 37return:38; CHECK: phi39  %retval.0 = phi ptr [ %A, %if.end ], [ null, %entry ]40  ret ptr %retval.041}42