brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 93c4ae6 Raw
31 lines · plain
1; RUN: opt -passes=instcombine -S < %s | FileCheck %s2target datalayout = "e-m:o-p:40:64:64:32-i64:64-f80:128-n8:16:32:64-S128"3 4; check that memory builtins can be handled.5define i64 @objsize1_custom_idx(i64 %sz) {6entry:7  %ptr = call ptr @malloc(i64 %sz)8  %ptr2 = getelementptr inbounds i8, ptr %ptr, i32 29  %calc_size = call i64 @llvm.objectsize.i64.p0(ptr %ptr2, i1 false, i1 true, i1 true)10  ret i64 %calc_size11}12 13%struct.V = type { [10 x i8], i32, [10 x i8] }14 15define i32 @objsize2_custom_idx() #0 {16entry:17  %var = alloca %struct.V, align 418  call void @llvm.lifetime.start.p0(ptr %var) #319  %arrayidx = getelementptr inbounds [10 x i8], ptr %var, i64 0, i64 120  %0 = call i64 @llvm.objectsize.i64.p0(ptr %arrayidx, i1 false, i1 false, i1 false)21  %conv = trunc i64 %0 to i3222  call void @llvm.lifetime.end.p0(ptr %var) #323  ret i32 %conv24; CHECK: ret i32 2725}26 27declare void @llvm.lifetime.start.p0(ptr nocapture) #128declare void @llvm.lifetime.end.p0(ptr nocapture) #129declare ptr @malloc(i64)30declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1)31