mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Update objectsize intrinsic and associated dependencies. Fix
lowering code and update testcases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91979 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac105c4dca
commit
d060b2576a
@ -260,7 +260,7 @@ def int_sigsetjmp : Intrinsic<[llvm_i32_ty] , [llvm_ptr_ty, llvm_i32_ty]>;
|
||||
def int_siglongjmp : Intrinsic<[llvm_void_ty], [llvm_ptr_ty, llvm_i32_ty]>;
|
||||
|
||||
// Internal interface for object size checking
|
||||
def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_ptr_ty, llvm_i32_ty],
|
||||
def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_ptr_ty, llvm_i1_ty],
|
||||
[IntrReadArgMem]>,
|
||||
GCCBuiltin<"__builtin_object_size">;
|
||||
|
||||
|
@ -4688,7 +4688,7 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
||||
SDValue Arg = getValue(I.getOperand(0));
|
||||
EVT Ty = Arg.getValueType();
|
||||
|
||||
if (CI->getZExtValue() < 2)
|
||||
if (CI->getZExtValue() == 0)
|
||||
Res = DAG.getConstant(-1ULL, Ty);
|
||||
else
|
||||
Res = DAG.getConstant(0, Ty);
|
||||
|
@ -1122,7 +1122,7 @@ struct SizeOpt : public LibCallOptimization {
|
||||
|
||||
const Type *Ty = Callee->getFunctionType()->getReturnType();
|
||||
|
||||
if (Const->getZExtValue() < 2)
|
||||
if (Const->getZExtValue() == 0)
|
||||
return Constant::getAllOnesValue(Ty);
|
||||
else
|
||||
return ConstantInt::get(Ty, 0);
|
||||
|
@ -10,7 +10,7 @@ target triple = "x86_64-apple-darwin10.0"
|
||||
define void @bar() nounwind ssp {
|
||||
entry:
|
||||
%tmp = load i8** @p ; <i8*> [#uses=1]
|
||||
%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i32 0) ; <i64> [#uses=1]
|
||||
%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 0) ; <i64> [#uses=1]
|
||||
%cmp = icmp ne i64 %0, -1 ; <i1> [#uses=1]
|
||||
; X64: movq $-1, %rax
|
||||
; X64: cmpq $-1, %rax
|
||||
@ -19,7 +19,7 @@ entry:
|
||||
cond.true: ; preds = %entry
|
||||
%tmp1 = load i8** @p ; <i8*> [#uses=1]
|
||||
%tmp2 = load i8** @p ; <i8*> [#uses=1]
|
||||
%1 = call i64 @llvm.objectsize.i64(i8* %tmp2, i32 1) ; <i64> [#uses=1]
|
||||
%1 = call i64 @llvm.objectsize.i64(i8* %tmp2, i1 1) ; <i64> [#uses=1]
|
||||
%call = call i8* @__strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 %1) ssp ; <i8*> [#uses=1]
|
||||
br label %cond.end
|
||||
|
||||
@ -33,7 +33,7 @@ cond.end: ; preds = %cond.false, %cond.t
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i64 @llvm.objectsize.i64(i8*, i32) nounwind readonly
|
||||
declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
|
||||
|
||||
declare i8* @__strcpy_chk(i8*, i8*, i64) ssp
|
||||
|
||||
@ -47,7 +47,7 @@ entry:
|
||||
%tmp = load i8** %__dest.addr ; <i8*> [#uses=1]
|
||||
%tmp1 = load i8** %__src.addr ; <i8*> [#uses=1]
|
||||
%tmp2 = load i8** %__dest.addr ; <i8*> [#uses=1]
|
||||
%0 = call i64 @llvm.objectsize.i64(i8* %tmp2, i32 1) ; <i64> [#uses=1]
|
||||
%0 = call i64 @llvm.objectsize.i64(i8* %tmp2, i1 1) ; <i64> [#uses=1]
|
||||
%call = call i8* @__strcpy_chk(i8* %tmp, i8* %tmp1, i64 %0) ssp ; <i8*> [#uses=1]
|
||||
store i8* %call, i8** %retval
|
||||
%1 = load i8** %retval ; <i8*> [#uses=1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user