[llvm] [AIX][TLS] Optimize the -maix-small-local-exec-tls local-exec access sequence for non-zero offsets (PR #71485)
Amy Kwan via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 22 12:18:05 PST 2023
================
@@ -7567,8 +7567,63 @@ static void reduceVSXSwap(SDNode *N, SelectionDAG *DAG) {
DAG->ReplaceAllUsesOfValueWith(SDValue(N, 0), N->getOperand(0));
}
+// For non-TOC-based local-exec access where an addi is feeding into another
+// addi, fold this sequence into a single addi if possible.
+static void foldADDIForLocalExecAccesses(SDNode *N, SelectionDAG *DAG) {
+ const PPCSubtarget &Subtarget =
+ DAG->getMachineFunction().getSubtarget<PPCSubtarget>();
+ // This optimization is only performed for non-TOC-based local-exec accesses.
+ if (!Subtarget.hasAIXSmallLocalExecTLS())
+ return;
+
+ if (N->getMachineOpcode() != PPC::ADDI8)
----------------
amy-kwan wrote:
Double check if `PPC::LA8` exists at this point. I think it only exists during assembly printing but it doesn't hurt to check.
https://github.com/llvm/llvm-project/pull/71485
More information about the llvm-commits
mailing list