[Patch] Kill LDTLSCleanup, let MachineCSE clean up local-dynamic TLS (PR13783)

Hans Wennborg hans at chromium.org
Mon Feb 11 11:27:25 PST 2013


On Mon, Feb 11, 2013 at 5:25 PM, Hans Wennborg <hans at chromium.org> wrote:
> On Fri, Feb 8, 2013 at 5:58 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>
>> On Feb 8, 2013, at 9:40 AM, Hans Wennborg <hans at chromium.org> wrote:
>>
>>> Hi all,
>>>
>>> The attached patch attempts to fix PR13783. The idea is to make it
>>> possible for MachineCSE (and cse during sdag construction) to clean up
>>> redundant TLS_base_addr instructions, rather than having a custom pass
>>> do it.
>>>
>>> To accomplish this, I have changed TLS_base_addr to define a vreg
>>> rather than placing its result in a physical register, and then expand
>>> to a call and a mov in MC lowering.
>>>
>>> I'm not super confident about the codegen parts of LLVM, so please
>>> take a close look.
>>
>> Looks good to me.
>>
>> Are there existing tests checking that CSE is working?
>
> But I now realize it only tests the 64-bit case, and my patch seems to
> break the 32-bit case. It seems the patch will need another iteration.

Ah, it's because TLS_base_addr32 uses EBX for the global base address,
and because of this physreg use, MachineCSE won't touch it.

Does anyone know if there is a technical reason it has to be EBX, or
could I just use whatever virtual register is defined by the
X86ISD::GlobalBaseReg node?

Thanks,
Hans



More information about the llvm-commits mailing list