Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst +++ docs/LangRef.rst @@ -4163,6 +4163,41 @@ !2 = !{ i8 0, i8 2, i8 3, i8 6 } !3 = !{ i8 -2, i8 0, i8 3, i8 6 } +'``llvm.objectsize``' Metadata +^^^^^^^^^^^^^^^^^^^^^^^^^ + +*Experimental/In progress* For reasons similar to ``tbaa``, ``llvm.objectsize`` +needs additional type information if it's asked to determine the size of a +member of a struct or array. However, full type information isn't necessary for +this task. In fact, all we need is an integer telling us how many bytes are +in the field being accessed by a `getelementptr` instruction. If this pointer is +based off of a previous pointer (e.g. in ``(char*)p + 1``), the integer is -1. + +An example of this metadata in action on a C object: + +.. code-block:: c + struct A { int8_t data[16]; }; + struct B { + int32_t foo; + struct A a; + int8_t bar; + } b[2]; + + int main() { + void \*p = &bs[0].a.data[10]; + void \*v = (char*)p + 1; + printf("%ld %ld\n", __builtin_object_size(p, 1), + __builtin_object_size(v, 1)); + } + // clang/LLVM produces (assuming some optimizations are run): + // %b = alloca i8, i32 21, align 4 + // %p = getelementptr inbounds %i8, i8* %b, i32 14, !metadata !1 + // %v = getelementptr inbounds %i8, i8* %p, i32 1, !metadata !2 + // ; Insert call printf instruction here + // !1 = !{i32 16} + // !2 = !{i32 -1} + + '``llvm.loop``' ^^^^^^^^^^^^^^^ @@ -11608,8 +11643,8 @@ :: - declare i32 @llvm.objectsize.i32(i8* , i1 ) - declare i64 @llvm.objectsize.i64(i8* , i1 ) + declare i32 @llvm.objectsize.i32(i8* , i8 ) + declare i64 @llvm.objectsize.i64(i8* , i8 ) Overview: """"""""" @@ -11625,10 +11660,19 @@ """""""""" The ``llvm.objectsize`` intrinsic takes two arguments. The first -argument is a pointer to or into the ``object``. The second argument is -a boolean and determines whether ``llvm.objectsize`` returns 0 (if true) -or -1 (if false) when the object size is unknown. The second argument -only accepts constants. +argument is a pointer to or into the ``object``. The second argument is an +integer in the range [0,3]. It is comprised of two flags: + +- If the low bit is set, the result will be the size of the closest array, as + defined by the accompanying type metadata. See the ``llvm.objectsize + Metadata`` section for more. If no metadata is available, it returns + conservatively (0) for ``type=3``, and as though ``type=0`` for ``type=1``. +- If the high bit is set, the result will be a lower bound on the size of the + object. Otherwise, it will be an upper bound. If the object size is unknown, + ``llvm.objectsize`` will return ``0`` or ``-1`` if this bit is set or unset, + respectively. + +The second argument only accepts constants. Semantics: """""""""" @@ -11636,7 +11680,7 @@ The ``llvm.objectsize`` intrinsic is lowered to a constant representing the size of the object concerned. If the size cannot be determined at compile time, ``llvm.objectsize`` returns ``i32/i64 -1 or 0`` (depending -on the ``min`` argument). +on the ``type`` argument). '``llvm.expect``' Intrinsic ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Index: include/llvm/IR/Intrinsics.td =================================================================== --- include/llvm/IR/Intrinsics.td +++ include/llvm/IR/Intrinsics.td @@ -381,7 +381,7 @@ def int_siglongjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoReturn]>; // Internal interface for object size checking -def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_anyptr_ty, llvm_i1_ty], +def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_anyptr_ty, llvm_i8_ty], [IntrNoMem]>, GCCBuiltin<"__builtin_object_size">; Index: lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- lib/CodeGen/CodeGenPrepare.cpp +++ lib/CodeGen/CodeGenPrepare.cpp @@ -1361,7 +1361,7 @@ default: break; case Intrinsic::objectsize: { // Lower all uses of llvm.objectsize.* - bool Min = (cast(II->getArgOperand(1))->getZExtValue() == 1); + bool Min = cast(II->getArgOperand(1))->getZExtValue() & 2; Type *ReturnTy = CI->getType(); Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL); Index: lib/CodeGen/SelectionDAG/FastISel.cpp =================================================================== --- lib/CodeGen/SelectionDAG/FastISel.cpp +++ lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1222,7 +1222,8 @@ } case Intrinsic::objectsize: { ConstantInt *CI = cast(II->getArgOperand(1)); - unsigned long long Res = CI->isZero() ? -1ULL : 0; + bool Min = CI->getZExtValue() & 2; + unsigned long long Res = Min ? 0 : -1ULL; Constant *ResCI = ConstantInt::get(II->getType(), Res); unsigned ResultReg = getRegForValue(ResCI); if (!ResultReg) Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4812,10 +4812,10 @@ SDValue Arg = getValue(I.getCalledValue()); EVT Ty = Arg.getValueType(); - if (CI->isZero()) - Res = DAG.getConstant(-1ULL, sdl, Ty); - else + if (CI->getZExtValue() & 2) Res = DAG.getConstant(0, sdl, Ty); + else + Res = DAG.getConstant(-1ULL, sdl, Ty); setValue(&I, Res); return nullptr; Index: lib/Transforms/InstCombine/InstCombineCalls.cpp =================================================================== --- lib/Transforms/InstCombine/InstCombineCalls.cpp +++ lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -531,6 +531,12 @@ default: break; case Intrinsic::objectsize: { uint64_t Size; + auto Arg = cast(II->getArgOperand(1))->getZExtValue(); + // TODO(gbiv): Add better support for type == 1 and type == 3 + // At the moment, just returning 0 is the best we can do for the lower bound + // of an inner member, because overestimation is incorrect. + if (Arg == 3) + return ReplaceInstUsesWith(CI, ConstantInt::get(CI.getType(), 0)); if (getObjectSize(II->getArgOperand(0), Size, DL, TLI)) return ReplaceInstUsesWith(CI, ConstantInt::get(CI.getType(), Size)); return nullptr; Index: lib/Transforms/InstCombine/InstructionCombining.cpp =================================================================== --- lib/Transforms/InstCombine/InstructionCombining.cpp +++ lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1949,7 +1949,8 @@ } else if (IntrinsicInst *II = dyn_cast(I)) { if (II->getIntrinsicID() == Intrinsic::objectsize) { ConstantInt *CI = cast(II->getArgOperand(1)); - uint64_t DontKnow = CI->isZero() ? -1ULL : 0; + bool Min = CI->getZExtValue() & 2; + uint64_t DontKnow = Min ? 0 : -1ULL; ReplaceInstUsesWith(*I, ConstantInt::get(I->getType(), DontKnow)); } } Index: test/Assembler/auto_upgrade_intrinsics.ll =================================================================== --- test/Assembler/auto_upgrade_intrinsics.ll +++ test/Assembler/auto_upgrade_intrinsics.ll @@ -8,7 +8,7 @@ declare i42 @llvm.ctlz.i42(i42) ; Not a power-of-2 -declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32(i8*, i8) nounwind readonly define void @test.ctlz(i8 %a, i16 %b, i32 %c, i42 %d) { @@ -55,6 +55,6 @@ ; CHECK-LABEL: @test.objectsize( ; CHECK: @llvm.objectsize.i32.p0i8 ; CHECK-DAG: declare i32 @llvm.objectsize.i32.p0i8 - %s = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) + %s = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) ret i32 %s } Index: test/CodeGen/AArch64/arm64-2012-07-11-InstrEmitterBug.ll =================================================================== --- test/CodeGen/AArch64/arm64-2012-07-11-InstrEmitterBug.ll +++ test/CodeGen/AArch64/arm64-2012-07-11-InstrEmitterBug.ll @@ -3,7 +3,7 @@ @shlib_path_substitutions = external hidden unnamed_addr global i8**, align 8 -declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readnone +declare i64 @llvm.objectsize.i64(i8*, i8) nounwind readnone declare noalias i8* @xmalloc(i64) optsize Index: test/CodeGen/AArch64/arm64-indexed-vector-ldst-2.ll =================================================================== --- test/CodeGen/AArch64/arm64-indexed-vector-ldst-2.ll +++ test/CodeGen/AArch64/arm64-indexed-vector-ldst-2.ll @@ -21,7 +21,7 @@ br i1 %cmp168, label %if.then172, label %return if.then172: ; preds = %cond.end90 - %7 = tail call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 false) + %7 = tail call i64 @llvm.objectsize.i64.p0i8(i8* undef, i8 0) br label %return return: ; preds = %if.then172, %cond.end90, %entry @@ -29,7 +29,7 @@ } ; Function Attrs: nounwind readnone -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) #1 +declare i64 @llvm.objectsize.i64.p0i8(i8*, i8) #1 attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { nounwind readnone } Index: test/CodeGen/AArch64/arm64-memset-to-bzero.ll =================================================================== --- test/CodeGen/AArch64/arm64-memset-to-bzero.ll +++ test/CodeGen/AArch64/arm64-memset-to-bzero.ll @@ -41,14 +41,14 @@ ; CHECK: memset define void @fct4(i8* %ptr) { entry: - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 0, i64 256, i64 %tmp) ret void } declare i8* @__memset_chk(i8*, i32, i64, i64) -declare i64 @llvm.objectsize.i64(i8*, i1) +declare i64 @llvm.objectsize.i64(i8*, i8) ; CHECK: @fct5 ; Size > 256, change. @@ -56,7 +56,7 @@ ; CHECK-LINUX: memset define void @fct5(i8* %ptr) { entry: - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 0, i64 257, i64 %tmp) ret void } @@ -68,7 +68,7 @@ define void @fct6(i8* %ptr, i32 %unknown) { entry: %conv = sext i32 %unknown to i64 - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 0, i64 %conv, i64 %tmp) ret void } @@ -81,7 +81,7 @@ ; CHECK: memset define void @fct7(i8* %ptr) { entry: - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 1, i64 256, i64 %tmp) ret void } @@ -91,7 +91,7 @@ ; CHECK: memset define void @fct8(i8* %ptr) { entry: - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 1, i64 257, i64 %tmp) ret void } @@ -102,7 +102,7 @@ define void @fct9(i8* %ptr, i32 %unknown) { entry: %conv = sext i32 %unknown to i64 - %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %call = tail call i8* @__memset_chk(i8* %ptr, i32 1, i64 %conv, i64 %tmp) ret void } Index: test/CodeGen/ARM/divmod.ll =================================================================== --- test/CodeGen/ARM/divmod.ll +++ test/CodeGen/ARM/divmod.ll @@ -60,7 +60,7 @@ %3 = load i32, i32* @tabsize, align 4 %4 = srem i32 %cols, %3 %5 = sdiv i32 %cols, %3 - %6 = tail call i32 @llvm.objectsize.i32.p0i8(i8* null, i1 false) + %6 = tail call i32 @llvm.objectsize.i32.p0i8(i8* null, i8 0) %7 = tail call i8* @__memset_chk(i8* null, i32 9, i32 %5, i32 %6) nounwind br label %bb1 @@ -71,7 +71,7 @@ ret void } -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readnone +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readnone declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind ; rdar://11714607 Index: test/CodeGen/Generic/crash.ll =================================================================== --- test/CodeGen/Generic/crash.ll +++ test/CodeGen/Generic/crash.ll @@ -23,7 +23,7 @@ %3 = load double, double* %1, align 4 %4 = load double, double* %0, align 4 call void @Parse_Vector(double* %0) nounwind -%5 = call i32 @llvm.objectsize.i32.p0i8(i8* undef, i1 false) +%5 = call i32 @llvm.objectsize.i32.p0i8(i8* undef, i8 0) %6 = icmp eq i32 %5, -1 br i1 %6, label %bb34, label %bb33 @@ -36,7 +36,7 @@ } declare void @Parse_Vector(double*) -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) ; PR9578 Index: test/CodeGen/Generic/object-size-type.ll =================================================================== --- /dev/null +++ test/CodeGen/Generic/object-size-type.ll @@ -0,0 +1,37 @@ +; A test to verify that we support objectsize with type == 0, 1, 2, 3 +; for simple cases with no metadata (for types 1, 3) + +; RUN: opt -instcombine < %s -S 2>&1 | FileCheck %s + +define void @verify_objectsize_supports_4_types() { + ; CHECK: @verify_objectsize_supports_4_types + + %p = alloca i8, i32 8, align 8 + %i = getelementptr i8, i8* %p, i32 4 + + ; CHECK: void @consume(i8 0, i32 4) + %1 = call i32 @llvm.objectsize.i32(i8* %i, i8 0) + call void @consume(i8 0, i32 %1) + + ; CHECK: void @consume(i8 1, i32 4) + %2 = call i32 @llvm.objectsize.i32(i8* %i, i8 1) + call void @consume(i8 1, i32 %2) + + ; CHECK: void @consume(i8 2, i32 4) + %3 = call i32 @llvm.objectsize.i32(i8* %i, i8 2) + call void @consume(i8 2, i32 %3) + + ; CHECK: void @consume(i8 3, i32 0) + %4 = call i32 @llvm.objectsize.i32(i8* %i, i8 3) + call void @consume(i8 3, i32 %4) + + ; At the time of writing, we need to keep %p alive. Otherwise, instcombine + ; will see the alloca is unused and RAUW(undef) it before objectsize can look + ; at it. @llvm.objectsize(undef) == conservative answer. + call void @keep_alive(i8* %p) + ret void +} + +declare void @consume(i8, i32) +declare void @keep_alive(i8*) +declare i32 @llvm.objectsize.i32(i8*, i8) Index: test/CodeGen/X86/2011-05-26-UnreachableBlockElim.ll =================================================================== --- test/CodeGen/X86/2011-05-26-UnreachableBlockElim.ll +++ test/CodeGen/X86/2011-05-26-UnreachableBlockElim.ll @@ -8,7 +8,7 @@ @aux_temp = external global %struct.dfa, align 8 -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone +declare i64 @llvm.objectsize.i64.p0i8(i8*, i8) nounwind readnone declare void @__memset_chk() nounwind @@ -21,12 +21,12 @@ br i1 undef, label %land.end.thread.i, label %land.end.i land.end.thread.i: ; preds = %if.end.i - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 false) nounwind + %0 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i8 0) nounwind %cmp1710.i = icmp eq i64 %0, -1 br i1 %cmp1710.i, label %cond.false156.i, label %cond.true138.i land.end.i: ; preds = %if.end.i - %1 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 false) nounwind + %1 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i8 0) nounwind %cmp17.i = icmp eq i64 %1, -1 br i1 %cmp17.i, label %cond.false156.i, label %cond.true138.i Index: test/CodeGen/X86/crash.ll =================================================================== --- test/CodeGen/X86/crash.ll +++ test/CodeGen/X86/crash.ll @@ -204,7 +204,7 @@ ; define fastcc void @func_61() nounwind sspreq { entry: - %t1 = tail call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 false) + %t1 = tail call i64 @llvm.objectsize.i64.p0i8(i8* undef, i8 0) %t2 = icmp eq i64 %t1, -1 br i1 %t2, label %bb2, label %bb1 @@ -215,7 +215,7 @@ ret void } -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone +declare i64 @llvm.objectsize.i64.p0i8(i8*, i8) nounwind readnone ; PR10277 ; This test has dead code elimination caused by remat during spilling. Index: test/CodeGen/X86/object-size.ll =================================================================== --- test/CodeGen/X86/object-size.ll +++ test/CodeGen/X86/object-size.ll @@ -10,7 +10,7 @@ define void @bar() nounwind ssp { entry: %tmp = load i8*, i8** @p ; [#uses=1] - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp, i1 0) ; [#uses=1] + %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp, i8 0) ; [#uses=1] %cmp = icmp ne i64 %0, -1 ; [#uses=1] ; CHECK: movq $-1, [[RAX:%r..]] ; CHECK: cmpq $-1, [[RAX]] @@ -19,7 +19,7 @@ cond.true: ; preds = %entry %tmp1 = load i8*, i8** @p ; [#uses=1] %tmp2 = load i8*, i8** @p ; [#uses=1] - %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 1) ; [#uses=1] + %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i8 2) ; [#uses=1] %call = call i8* @__strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 %1) ssp ; [#uses=1] br label %cond.end @@ -33,7 +33,7 @@ ret void } -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readonly +declare i64 @llvm.objectsize.i64.p0i8(i8*, i8) nounwind readonly declare i8* @__strcpy_chk(i8*, i8*, i64) ssp @@ -47,7 +47,7 @@ %tmp = load i8*, i8** %__dest.addr ; [#uses=1] %tmp1 = load i8*, i8** %__src.addr ; [#uses=1] %tmp2 = load i8*, i8** %__dest.addr ; [#uses=1] - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 1) ; [#uses=1] + %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i8 2) ; [#uses=1] %call = call i8* @__strcpy_chk(i8* %tmp, i8* %tmp1, i64 %0) ssp ; [#uses=1] store i8* %call, i8** %retval %1 = load i8*, i8** %retval ; [#uses=1] Index: test/Transforms/CodeGenPrepare/basic.ll =================================================================== --- test/Transforms/CodeGenPrepare/basic.ll +++ test/Transforms/CodeGenPrepare/basic.ll @@ -9,7 +9,7 @@ ; rdar://8785296 define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 { entry: - %0 = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false) + %0 = tail call i64 @llvm.objectsize.i64(i8* %ptr, i8 0) %1 = icmp ugt i64 %0, 3 br i1 %1, label %T, label %trap @@ -25,6 +25,6 @@ ret i32 4 } -declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly +declare i64 @llvm.objectsize.i64(i8*, i8) nounwind readonly declare void @llvm.trap() nounwind Index: test/Transforms/InstCombine/debuginfo.ll =================================================================== --- test/Transforms/InstCombine/debuginfo.ll +++ test/Transforms/InstCombine/debuginfo.ll @@ -2,7 +2,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone +declare i64 @llvm.objectsize.i64.p0i8(i8*, i8) nounwind readnone declare i8* @foo(i8*, i32, i64, i64) nounwind @@ -23,7 +23,7 @@ %tmp1 = load i32, i32* %__val.addr, align 4, !dbg !21 %tmp2 = load i64, i64* %__len.addr, align 8, !dbg !21 %tmp3 = load i8*, i8** %__dest.addr, align 8, !dbg !21 - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp3, i1 false), !dbg !21 + %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp3, i8 0), !dbg !21 %call = call i8* @foo(i8* %tmp, i32 %tmp1, i64 %tmp2, i64 %0), !dbg !21 ret i8* %call, !dbg !21 } Index: test/Transforms/InstCombine/invoke.ll =================================================================== --- test/Transforms/InstCombine/invoke.ll +++ test/Transforms/InstCombine/invoke.ll @@ -3,7 +3,7 @@ declare i32 @__gxx_personality_v0(...) declare void @__cxa_call_unexpected(i8*) -declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly +declare i64 @llvm.objectsize.i64(i8*, i8) nounwind readonly declare i8* @_Znwm(i64) @@ -16,7 +16,7 @@ invoke.cont: ; CHECK: ret i64 0 - %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false) + %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i8 0) ret i64 %0 lpad: @@ -36,7 +36,7 @@ invoke.cont: ; CHECK: ret i64 0 - %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false) + %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i8 0) ret i64 %0 lpad: Index: test/Transforms/InstCombine/malloc-free-delete.ll =================================================================== --- test/Transforms/InstCombine/malloc-free-delete.ll +++ test/Transforms/InstCombine/malloc-free-delete.ll @@ -26,7 +26,7 @@ declare void @llvm.lifetime.start(i64, i8*) declare void @llvm.lifetime.end(i64, i8*) -declare i64 @llvm.objectsize.i64(i8*, i1) +declare i64 @llvm.objectsize.i64(i8*, i8) declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) nounwind @@ -37,7 +37,7 @@ %a = call noalias i8* @malloc(i32 10) call void @llvm.lifetime.start(i64 10, i8* %a) call void @llvm.lifetime.end(i64 10, i8* %a) - %size = call i64 @llvm.objectsize.i64(i8* %a, i1 true) + %size = call i64 @llvm.objectsize.i64(i8* %a, i8 2) store i8 42, i8* %a call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %src, i32 32, i32 1, i1 false) call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* %src, i32 32, i32 1, i1 false) Index: test/Transforms/InstCombine/objsize-64.ll =================================================================== --- test/Transforms/InstCombine/objsize-64.ll +++ test/Transforms/InstCombine/objsize-64.ll @@ -5,13 +5,13 @@ declare noalias i8* @_Znwm(i64) ; new(unsigned long) declare i32 @__gxx_personality_v0(...) declare void @__cxa_call_unexpected(i8*) -declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly +declare i64 @llvm.objectsize.i64(i8*, i8) nounwind readonly ; CHECK-LABEL: @f1( define i64 @f1(i8 **%esc) { %call = call i8* @malloc(i32 4) store i8* %call, i8** %esc - %size = call i64 @llvm.objectsize.i64(i8* %call, i1 false) + %size = call i64 @llvm.objectsize.i64(i8* %call, i8 0) ; CHECK: ret i64 4 ret i64 %size } @@ -27,7 +27,7 @@ invoke.cont: ; CHECK: ret i64 13 store i8* %call, i8** %esc - %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false) + %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i8 0) ret i64 %0 lpad: Index: test/Transforms/InstCombine/objsize-address-space.ll =================================================================== --- test/Transforms/InstCombine/objsize-address-space.ll +++ test/Transforms/InstCombine/objsize-address-space.ll @@ -1,11 +1,11 @@ ; RUN: opt -S -instcombine -o - %s | FileCheck %s target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly -declare i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)*, i1) nounwind readonly -declare i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)*, i1) nounwind readonly -declare i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)*, i1) nounwind readonly -declare i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readonly +declare i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)*, i8) nounwind readonly +declare i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)*, i8) nounwind readonly +declare i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)*, i8) nounwind readonly +declare i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)*, i8) nounwind readonly @array_as2 = private addrspace(2) global [60 x i8] zeroinitializer, align 4 @@ -21,20 +21,20 @@ define i32 @foo_as3() nounwind { ; CHECK-LABEL: @foo_as3( ; CHECK-NEXT: ret i32 60 - %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i1 false) + %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i8 0) ret i32 %1 } define i16 @foo_as3_i16() nounwind { ; CHECK-LABEL: @foo_as3_i16( ; CHECK-NEXT: ret i16 60 - %1 = call i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i1 false) + %1 = call i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i8 0) ret i16 %1 } @a_alias = weak alias [60 x i8] addrspace(3)* @a_as3 define i32 @foo_alias() nounwind { - %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_alias, i32 0, i32 0), i1 false) + %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_alias, i32 0, i32 0), i8 0) ret i32 %1 } @@ -42,7 +42,7 @@ ; CHECK-LABEL: @array_as2_size( ; CHECK-NEXT: ret i32 60 %bc = bitcast [60 x i8] addrspace(2)* @array_as2 to i8 addrspace(2)* - %1 = call i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)* %bc, i8 0) ret i32 %1 } @@ -50,7 +50,7 @@ ; CHECK-LABEL: @pointer_array_as1( ; CHECK-NEXT: ret i32 80 %bc = addrspacecast [10 x i32 addrspace(1)*]* @array_as1_pointers to i8 addrspace(1)* - %1 = call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* %bc, i8 0) ret i32 %1 } @@ -58,7 +58,7 @@ ; CHECK-LABEL: @pointer_array_as2( ; CHECK-NEXT: ret i32 24 %bc = bitcast [24 x i32 addrspace(2)*]* @array_as2_pointers to i8* - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i8 0) ret i32 %1 } @@ -66,7 +66,7 @@ ; CHECK-LABEL: @pointer_array_as3( ; CHECK-NEXT: ret i32 84 %bc = bitcast [42 x i32 addrspace(3)*]* @array_as3_pointers to i8* - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i8 0) ret i32 %1 } @@ -74,7 +74,7 @@ ; CHECK-LABEL: @pointer_pointer_array_as2_as1( ; CHECK-NEXT: ret i32 128 %bc = bitcast [16 x i32 addrspace(2)* addrspace(1)*]* @array_as2_as1_pointer_pointers to i8* - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i8 0) ret i32 %1 } Index: test/Transforms/InstCombine/objsize-noverify.ll =================================================================== --- test/Transforms/InstCombine/objsize-noverify.ll +++ test/Transforms/InstCombine/objsize-noverify.ll @@ -3,7 +3,7 @@ ; We need target data to get the sizes of the arrays and structures. 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" -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readonly ; CHECK-LABEL: @PR13390( define i32 @PR13390(i1 %bool, i8* %a) { @@ -14,8 +14,8 @@ xpto: %select = select i1 %bool, i8* %select, i8* %a %select2 = select i1 %bool, i8* %a, i8* %select2 - %0 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select, i1 true) - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select2, i1 true) + %0 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select, i8 2) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select2, i8 2) %2 = add i32 %0, %1 ; CHECK: ret i32 undef ret i32 %2 @@ -34,7 +34,7 @@ xpto: %gep2 = getelementptr i8, i8* %gep, i32 1 %gep = getelementptr i8, i8* %gep2, i32 1 - %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 true) + %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i8 2) ; CHECK: ret i32 undef ret i32 %o Index: test/Transforms/InstCombine/objsize.ll =================================================================== --- test/Transforms/InstCombine/objsize.ll +++ test/Transforms/InstCombine/objsize.ll @@ -8,7 +8,7 @@ define i32 @foo() nounwind { ; CHECK-LABEL: @foo( ; CHECK-NEXT: ret i32 60 - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) ret i32 %1 } @@ -16,7 +16,7 @@ ; CHECK-LABEL: @bar( entry: %retval = alloca i8* - %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) + %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) %cmp = icmp ne i32 %0, -1 ; CHECK: br i1 true br i1 %cmp, label %cond.true, label %cond.false @@ -33,7 +33,7 @@ define i32 @f() nounwind { ; CHECK-LABEL: @f( ; CHECK-NEXT: ret i32 0 - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8], [60 x i8]* @a, i32 1, i32 0), i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8], [60 x i8]* @a, i32 1, i32 0), i8 0) ret i32 %1 } @@ -42,7 +42,7 @@ define i1 @baz() nounwind { ; CHECK-LABEL: @baz( ; CHECK-NEXT: objectsize - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 0), i1 false) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 0), i8 0) %2 = icmp eq i32 %1, -1 ret i1 %2 } @@ -51,7 +51,7 @@ ; CHECK-LABEL: @test1( ; CHECK: objectsize.i32.p0i8 entry: - %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 10), i1 false) ; [#uses=1] + %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 10), i8 0) ; [#uses=1] %1 = icmp eq i32 %0, -1 ; [#uses=1] br i1 %1, label %"47", label %"46" @@ -67,7 +67,7 @@ define i32 @test2() nounwind { ; CHECK-LABEL: @test2( ; CHECK-NEXT: ret i32 34 - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr (i8, i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr (i8, i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i8 0) ret i32 %1 } @@ -76,7 +76,7 @@ declare i8* @__memcpy_chk(i8*, i8*, i32, i32) nounwind -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readonly declare i8* @__inline_memcpy_chk(i8*, i8*, i32) nounwind inlinehint @@ -88,7 +88,7 @@ bb11: %0 = getelementptr inbounds float, float* getelementptr inbounds ([480 x float], [480 x float]* @array, i32 0, i32 128), i32 -127 ; [#uses=1] %1 = bitcast float* %0 to i8* ; [#uses=1] - %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i1 false) ; [#uses=1] + %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i8 0) ; [#uses=1] %3 = call i8* @__memcpy_chk(i8* undef, i8* undef, i32 512, i32 %2) nounwind ; [#uses=0] ; CHECK: unreachable unreachable @@ -110,7 +110,7 @@ entry: %0 = alloca %struct.data, align 8 %1 = bitcast %struct.data* %0 to i8* - %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i1 false) nounwind + %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i8 0) nounwind ; CHECK-NOT: @llvm.objectsize ; CHECK: @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 1824, i32 8, i1 false) %3 = call i8* @__memset_chk(i8* %1, i32 0, i32 1824, i32 %2) nounwind @@ -125,7 +125,7 @@ ; CHECK-LABEL: @test5( entry: %0 = tail call noalias i8* @malloc(i32 20) nounwind - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i8 0) %2 = load i8*, i8** @s, align 8 ; CHECK-NOT: @llvm.objectsize ; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 10, i32 1, i1 false) @@ -137,7 +137,7 @@ ; CHECK-LABEL: @test6( entry: %0 = tail call noalias i8* @malloc(i32 20) nounwind - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i8 0) %2 = load i8*, i8** @s, align 8 ; CHECK-NOT: @llvm.objectsize ; CHECK: @__memcpy_chk(i8* %0, i8* %1, i32 30, i32 20) @@ -154,7 +154,7 @@ %alloc = call noalias i8* @malloc(i32 48) nounwind store i8* %alloc, i8** %esc %gep = getelementptr inbounds i8, i8* %alloc, i32 16 - %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly + %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i8 0) nounwind readonly ; CHECK: ret i32 32 ret i32 %objsize } @@ -166,7 +166,7 @@ %alloc = call noalias i8* @calloc(i32 5, i32 7) nounwind store i8* %alloc, i8** %esc %gep = getelementptr inbounds i8, i8* %alloc, i32 5 - %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly + %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i8 0) nounwind readonly ; CHECK: ret i32 30 ret i32 %objsize } @@ -178,7 +178,7 @@ define i32 @test9(i8** %esc) { %call = tail call i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)) nounwind store i8* %call, i8** %esc, align 8 - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i8 2) ; CHECK: ret i32 8 ret i32 %1 } @@ -187,7 +187,7 @@ define i32 @test10(i8** %esc) { %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 3) nounwind store i8* %call, i8** %esc, align 8 - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i8 2) ; CHECK: ret i32 4 ret i32 %1 } @@ -196,7 +196,7 @@ define i32 @test11(i8** %esc) { %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7) nounwind store i8* %call, i8** %esc, align 8 - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i8 2) ; CHECK: ret i32 8 ret i32 %1 } @@ -205,7 +205,7 @@ define i32 @test12(i8** %esc) { %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 8) nounwind store i8* %call, i8** %esc, align 8 - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i8 2) ; CHECK: ret i32 8 ret i32 %1 } @@ -214,7 +214,7 @@ define i32 @test13(i8** %esc) { %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 57) nounwind store i8* %call, i8** %esc, align 8 - %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true) + %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i8 2) ; CHECK: ret i32 8 ret i32 %1 } @@ -225,7 +225,7 @@ ; CHECK-NEXT: ret i32 60 define i32 @test18() { %bc = bitcast [60 x i8]* @globalalias to i8* - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i8 0) ret i32 %1 } @@ -235,7 +235,7 @@ ; CHECK: llvm.objectsize define i32 @test19() { %bc = bitcast [60 x i8]* @globalalias2 to i8* - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false) + %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i8 0) ret i32 %1 } Index: test/Transforms/InstCombine/stpcpy_chk-1.ll =================================================================== --- test/Transforms/InstCombine/stpcpy_chk-1.ll +++ test/Transforms/InstCombine/stpcpy_chk-1.ll @@ -64,10 +64,10 @@ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0 -; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) +; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) ; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len) ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11) - %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false) + %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i8 0) %ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 %len) ret i8* %ret } @@ -81,7 +81,7 @@ ; CHECK-NEXT: %strlen = call i32 @strlen(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)) ; CHECK-NEXT: %1 = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 %strlen ; CHECK-NEXT: ret i8* %1 - %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false) + %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i8 0) %ret = call i8* @__stpcpy_chk(i8* %dst, i8* %dst, i32 %len) ret i8* %ret } @@ -100,4 +100,4 @@ } declare i8* @__stpcpy_chk(i8*, i8*, i32) nounwind -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readonly Index: test/Transforms/InstCombine/strcpy_chk-1.ll =================================================================== --- test/Transforms/InstCombine/strcpy_chk-1.ll +++ test/Transforms/InstCombine/strcpy_chk-1.ll @@ -64,10 +64,10 @@ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0 -; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) +; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) ; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len) ; CHECK-NEXT: ret i8* %1 - %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false) + %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i8 0) %ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 %len) ret i8* %ret } @@ -78,10 +78,10 @@ ; CHECK-LABEL: @test_simplify6( %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 -; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) +; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8 0) ; CHECK-NEXT: %ret = call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i32 %len) ; CHECK-NEXT: ret i8* %ret - %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false) + %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i8 0) %ret = call i8* @__strcpy_chk(i8* %dst, i8* %dst, i32 %len) ret i8* %ret } @@ -100,4 +100,4 @@ } declare i8* @__strcpy_chk(i8*, i8*, i32) nounwind -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly +declare i32 @llvm.objectsize.i32.p0i8(i8*, i8) nounwind readonly