[PATCH] D69490: [LoopIdiomRecognize] Avoid trying to create a pattern from the address of a thread local.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 12:04:49 PDT 2019


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:444-449
+  // While technically constant, the address of a thread_local GlobalVariable
+  // isn't known until runtime and would require additional tls init code to
+  // handle correctly.
+  if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
+    if (GV->isThreadDependent())
+      return nullptr;
----------------
bobsayshilol wrote:
> lebedev.ri wrote:
> > What about `GlobalVariable`'s that aren't global constants?
> > 
> Can you give an example? `GlobalVariable` inherits from `Constant` since their address is constant, so my understanding was that all `GlobalVariable`s are therefore (global) `Constant`s.
I mean, is there any other `Constant` (other than this `GlobalVariable->isThreadDependent()`)
that could lead to similar miscompiles?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69490





More information about the llvm-commits mailing list