[llvm-commits] [llvm-gcc-4.2] r85265 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Bob Wilson
bob.wilson at apple.com
Tue Oct 27 10:53:33 PDT 2009
Author: bwilson
Date: Tue Oct 27 12:53:33 2009
New Revision: 85265
URL: http://llvm.org/viewvc/llvm-project?rev=85265&view=rev
Log:
Revert 85190 change for BUILT_IN_OBJECT_SIZE.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=85265&r1=85264&r2=85265&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 27 12:53:33 2009
@@ -4966,12 +4966,12 @@
return EmitBuiltinUnwindInit(exp, Result);
case BUILT_IN_OBJECT_SIZE: {
- tree arglist = TREE_OPERAND (exp, 1);
- if (!validate_arglist(arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) {
+ tree ArgList = TREE_OPERAND (exp, 1);
+ if (!validate_arglist(ArgList, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) {
error("Invalid builtin_object_size argument types");
return false;
}
- tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (arglist));
+ tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (ArgList));
STRIP_NOPS (ObjSizeTree);
if (TREE_CODE (ObjSizeTree) != INTEGER_CST
|| tree_int_cst_sgn (ObjSizeTree) < 0
@@ -4980,24 +4980,12 @@
return false;
}
- tree Object = TREE_VALUE(arglist);
- tree ObjTy = TREE_VALUE(TREE_CHAIN(arglist));
-
- Value* Args[] = {
- Emit(Object, 0),
- Emit(ObjTy, 0)
- };
-
- const Type* Ty[3];
- Ty[0] = ConvertType(TREE_TYPE(exp));
- Ty[1] = Type::getInt8PtrTy(Context);
- Ty[2] = Type::getInt32Ty(Context);
-
- Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::objectsize,
- Ty,
- 1),
- Args, Args + 2);
+ // This treats everything as unknown, and is minimally defensible as
+ // correct, although completely useless.
+ if (tree_low_cst (ObjSizeTree, 0) < 2)
+ Result = Constant::getAllOnesValue(TD.getIntPtrType(Context));
+ else
+ Result = ConstantInt::get(TD.getIntPtrType(Context), 0);
return true;
}
// Unary bit counting intrinsics.
More information about the llvm-commits
mailing list