1 ; Test objectsize bounds checking that won't verify until after -instcombine.
2 ; RUN: opt < %s -disable-verify -instcombine -S | opt -S | FileCheck %s
3 ; We need target data to get the sizes of the arrays and structures.
4 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
6 declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
8 ; CHECK-LABEL: @PR13390(
9 define i32 @PR13390(i1 %bool, i8* %a) {
11 %cond = or i1 %bool, true
12 br i1 %cond, label %return, label %xpto
15 %select = select i1 %bool, i8* %select, i8* %a
16 %select2 = select i1 %bool, i8* %a, i8* %select2
17 %0 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select, i1 true)
18 %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select2, i1 true)
20 ; CHECK: ret i32 undef
27 ; CHECK-LABEL: @PR13621(
28 define i32 @PR13621(i1 %bool) nounwind {
30 %cond = or i1 %bool, true
31 br i1 %cond, label %return, label %xpto
33 ; technically reachable, but this malformed IR may appear as a result of constant propagation
35 %gep2 = getelementptr i8, i8* %gep, i32 1
36 %gep = getelementptr i8, i8* %gep2, i32 1
37 %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 true)
38 ; CHECK: ret i32 undef