[PATCH] D72878: [X86][BranchAlign] Suppress branch alignment for {,_}__tls_get_addr

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 19:40:22 PST 2020


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: llvm/test/CodeGen/X86/align-branch-boundary-suppressions-tls.ll:21
+; CHECK: #noautopadding
+; 32: leal ld at TLSLDM(%ebx), %eax
+; 32: calll ___tls_get_addr at PLT
----------------
skan wrote:
> MaskRay wrote:
> > LuoYuanke wrote:
> > > Obviously disable auto padding for TLS is safety, but I am curious what's the problem if we don't  disable it? In our previous patch, we check if there is any variant symbol in needAlignInst(...).
> > This only affects x86-64 General Dynamic TLS model, which emits some prefixes.
> > 
> > ```
> > (DATA16_PREFIX)
> > (LEA64r)
> > <--- Diff 21 can place cs (0x2e) here and break the General Dynamic TLS code sequence --->
> > <MCInst 851> (DATA16_PREFIX)
> > <MCInst 851> (DATA16_PREFIX)
> > <MCInst 2450> (REX64_PREFIX)
> > <MCInst 602 <MCOperand Expr:(__tls_get_addr at PLT)>> CALL64pcrel32
> > ```
> > 
> > D72225 can prepend another prefix and cause a failure.
> Could you provide a assemble file to help us reproduce the fail? That will be more helpful.
```lang=cpp
extern __thread int i;
int foo() { return i; }
```

-fPIC will give you a General Dynamic TLS code sequence. You can repeat the code sequence, and then add some jcc. I think you will be able to reproduce it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72878/new/

https://reviews.llvm.org/D72878





More information about the llvm-commits mailing list