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

Duncan Sands baldrick at free.fr
Fri Jul 29 09:56:21 PDT 2011


Hi Bob,

> I'm seeing regressions at -O0 for ARM on the following tests:
>
> SingleSource/UnitTests/ObjC/instance-method-metadata.compile
> SingleSource/UnitTests/ObjC/property.compile
> SingleSource/UnitTests/ObjC/protocols.compile
> SingleSource/UnitTests/ObjC/trivial-interface.compile
>
> They're hitting an assertion:
>
> Assertion failed: (InitVal->getType() == getType()->getElementType()&&  "Initializer type must match GlobalVariable type"), function setInitializer, file /Volumes/LocalHD/bwilson/nightly/src/llvm/lib/VMCore/Globals.cpp, line 168.
>
> I'll have to rebuild with debugging to figure out exactly what is causing this, but these changes seem like the most likely culprits.  The stack trace is:

the hack I applied has the nasty property that when converting a GCC type, the
result you get may be different depending on whether you convert it as part of
converting another type or not.  That could lead to subtle problems I guess.
One example of this is that a T* might be converted into a ConvertType(T)* in
some places, and into an i8* in others.

I can reproduce this locally - I should have paid more attention to the ObjC
"make check" results, sorry about that (on linux you always get a bazillion
ObjC failures, and I didn't notice that the number of failures had gone up by
two) - and will probably take a look over the weekend sometime.

Ciao, Duncan.

>
> (gdb) where
> #0  0x900fb236 in __pthread_kill ()
> #1  0x900faad7 in pthread_kill ()
> #2  0x40dd527b in abort ()
> #3  0x40dd52f2 in __assert_rtn ()
> #4  0x40cfa2f7 in llvm::GlobalVariable::setInitializer ()
> #5  0x00264a25 in llvm::GlobalValue::hasHiddenVisibility () at /llvmgcc42_Embedded~obj/dst-llvmCore/Developer/usr/local/include/llvm/GlobalValue.h:1384
> #6  0x00264a25 in reset_initializer_llvm (decl=0x9d03f0) at /llvmgcc42_Embedded~obj/src/gcc/llvm-backend.cpp:1385
> #7  0x00036b74 in generate_v2_protocols [inlined] () at /Volumes/LocalHD/bwilson/nightly/src/llvm-gcc-4.2/gcc/objc/objc-act.c:14476
> #8  0x00036b74 in finish_objc () at /llvmgcc42_Embedded~obj/src/gcc/objc/objc-act.c:19331
> #9  0x0003914b in objc_finish_file () at //llvmgcc42_Embedded~obj/src/gcc/objc/objc-act.c:841
> #10 0x00093055 in c_common_parse_file (set_yydebug=0) at /llvmgcc42_Embedded~obj/src/gcc/c-opts.c:1327
> #11 0x0023194d in toplev_main () at /llvmgcc42_Embedded~obj/src/gcc/toplev.c:1115
> #12 0x000b9a8c in main () at /llvmgcc42_Embedded~obj/src/gcc/llvm-main.cpp:47
>
> On Jul 28, 2011, at 2:13 AM, Duncan Sands wrote:
>
>> Author: baldrick
>> Date: Thu Jul 28 04:13:43 2011
>> New Revision: 136345
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=136345&view=rev
>> Log:
>> Work around some fallout from the previous hack to work around
>> problems with the new type system.  Will hopefully fix some
>> buildbots.
>>
>> 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=136345&r1=136344&r2=136345&view=diff
>> ==============================================================================
>> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 28 04:13:43 2011
>> @@ -8699,14 +8699,15 @@
>>      break;
>>    }
>>
>> -  // Check that the type of the lvalue is indeed that of a pointer to the tree
>> -  // node.  Since LLVM has no void* type, don't insist that void* be converted
>> -  // to a specific LLVM type.
>> -  assert((VOID_TYPE_P(TREE_TYPE(exp)) ||
>> -          LV->getType() == ConvertType(TREE_TYPE(exp))->getPointerTo())&&
>> -         "LValue of constant has wrong type!");
>> +  // Ensure that the lvalue has the expected type.  It is simpler to do this
>> +  // once here rather than in every helper.
>> +  Type *Ty;
>> +  if (VOID_TYPE_P(TREE_TYPE(exp)))
>> +    Ty = Type::getInt8Ty(Context); // void* ->  i8*.
>> +  else
>> +    Ty = ConvertType(TREE_TYPE(exp));
>>
>> -  return LV;
>> +  return TheFolder->CreateBitCast(LV, Ty->getPointerTo());
>> }
>>
>> Constant *TreeConstantToLLVM::EmitLV_Decl(tree exp) {
>>
>>
>> _______________________________________________
>> 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