[llvm] [AIX][TLS] Optimize the small local-exec access sequence for non-zero offsets (PR #71485)

Amy Kwan via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 08:31:36 PST 2024


================
@@ -7578,6 +7668,10 @@ void PPCDAGToDAGISel::PeepholePPC64() {
     if (isVSXSwap(SDValue(N, 0)))
       reduceVSXSwap(N, CurDAG);
 
+    // This optimization is performed for non-TOC-based local-exec accesses.
+    if (HasAIXSmallLocalExecTLS)
+      foldADDIForLocalExecAccesses(N, CurDAG);
----------------
amy-kwan wrote:

I think I see what you mean. If we have successfully did the transformation in `foldADDIForLocalExecAccesses()`, we're still going to have `PPC::ADDI8` and it will continue down into the code below.

I think this is fine and is what I initially expected, because as you mentioned, it will hit the `default: continue;` code, which makes sense all of the code below that point checks for if `N` is a load/store (which will be false since we have an `PPC::ADDI8` in the current iteration), so it will go into checking the next `N` (which could be an addi, load, store, etc) and do the most suitable transformation depending on the opcode.

I think what I have done here would be similar to the check and transformation above my change,
```
    if (isVSXSwap(SDValue(N, 0)))
      reduceVSXSwap(N, CurDAG);
``` 

https://github.com/llvm/llvm-project/pull/71485


More information about the llvm-commits mailing list