[llvm-commits] [llvm-gcc-4.2] r85190 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Bob Wilson bob.wilson at apple.com
Tue Oct 27 10:06:45 PDT 2009


Eric, my debug build of llvm is failing and it seems to be related to  
this change:

	make -C libprofile all
llvm[2]: Compiling CommonProfiling.ll to CommonProfiling.bc for Debug  
build (bytecode)
/Users/bwilson/local/llvm/objdir/Debug/bin/opt /Volumes/LocalHD/ 
bwilson/llvm/objdir/runtime/libprofile/Debug/CommonProfiling.ll -std- 
compile-opts -strip-debug -o /Volumes/LocalHD/bwilson/llvm/objdir/ 
runtime/libprofile/Debug/CommonProfiling.bc
/Users/bwilson/local/llvm/objdir/Debug/bin/opt: /Volumes/LocalHD/ 
bwilson/llvm/objdir/runtime/libprofile/Debug/CommonProfiling.ll: 
251:19: error: '@llvm.objectsize.i64' defined with type 'i64 (i8**,  
i32)*'
   %125 = call i64 @llvm.objectsize.i64(i8* %124, i32 0), !dbg !38 ;  
<i64> [#uses=1]
                   ^
make[2]: *** [/Volumes/LocalHD/bwilson/llvm/objdir/runtime/libprofile/ 
Debug/CommonProfiling.bc] Error 1
make[1]: *** [libprofile/.makeall] Error 2
make: *** [all] Error 1

This did not happen when the llvm-gcc used to compile  
CommonProfiling.c did not include this patch.  Can you please  
investigate?  Thanks.

On Oct 26, 2009, at 5:53 PM, Eric Christopher wrote:

> Author: echristo
> Date: Mon Oct 26 19:53:46 2009
> New Revision: 85190
>
> URL: http://llvm.org/viewvc/llvm-project?rev=85190&view=rev
> Log:
> Use new objectsize intrinsic for object size checking instead of
> folding to "don't know" immediately.
>
> 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=85190&r1=85189&r2=85190&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 26 19:53:46 2009
> @@ -4976,12 +4976,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
> @@ -4990,12 +4990,24 @@
>       return false;
>     }
>
> -    // 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);
> +    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);
>     return true;
>   }
>   // Unary bit counting intrinsics.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list