[LLVMdev] LLC Bug x86 with thread local storage

Patrick Marlier patrick.marlier at unine.ch
Wed Jul 7 12:44:31 PDT 2010


On 07/07/2010 08:20 PM, Eric Christopher wrote:
>
> On Jul 7, 2010, at 4:52 AM, Patrick Marlier wrote:
>
>> Which one is correct ?
>> - movl    $tm_nest_level at TPOFF, %ecx
>> or
>> - movq    $tm_nest_level at TPOFF, %rcx
>> or
>> - movl    tm_nest_level at TPOFF, %ecx
>>
>
> I believe this is initial exec and so from:
>
> http://people.redhat.com/drepper/tls.pdf
>
> it would be movl tm_nest_level at TPOFF, %ecx
>
>> Otherwise, Is there a way to remove this $ character?
>>
>> I found that it is here in lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
>>
>> void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
>>                                      raw_ostream&O) {
>>   const MCOperand&Op = MI->getOperand(OpNo);
>>   if (Op.isReg()) {
>>     O<<  '%'<<  getRegisterName(Op.getReg());
>>   } else if (Op.isImm()) {
>>     ...
>>   } else {
>>     assert(Op.isExpr()&&  "unknown operand kind in printOperand");
>> // HERE I remove the '$' to make it work
>>     O<<  '$'<<  *Op.getExpr();
>>   }
>>
>
> Hrm.  Something is wonky here.  Can you file a testcase with a .i file I can compile please?
>
> -eric

Is the testcase from Eli Friedman not enough?

http://llvm.org/bugs/show_bug.cgi?id=5081
Eli Friedman 2009-10-02 20:15:35 CDT
Reduced testcase:

target triple = "x86_64-unknown-linux-gnu"
@tm_nest_level = internal thread_local global i32 0
define i64 @z() nounwind {
   ret i64 and (i64 ptrtoint (i32* @tm_nest_level to i64), i64 100)
}

Because actually, the C application where it happens is really huge and 
I don't know if I will be able to provide you a really simple testcase.

Tell me if it is really required I can try to do it tomorrow.

Patrick Marlier.



More information about the llvm-dev mailing list