[PATCH] D120000: [1/2] TLS loads opimization (hoist)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 23:29:53 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/TLSVariableHoist.cpp:198
+
+  BasicBlock *PreHeader = L->getLoopPredecessor();
+
----------------
xiangzhangllvm wrote:
> craig.topper wrote:
> > Predecessor and PreHeader aren't quite the same thing. A PreHeader also has the loop as it's only successor.
> Sorry, not much clear about it.
> My understand is the PreHeader here not in loop (currently it is the outermost loop), so if here has  PreHeader for the loop, we can directly insert the bitcast instruction in  PreHeader. 
> Because the PreHeader must dominate the Loop (It is the only way to go to Loop).
> 
> 
> ```
> PreHeader
>     |
>     V
>    Loop
> ```
There is a function called getLoopPredecessor and another called getLoopPreheader. You called the former, but named the variable like you called the latter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120000



More information about the llvm-commits mailing list