diff options
author | zhijian lin <zhijian@ca.ibm.com> | 2025-06-05 09:41:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-05 09:41:51 -0400 |
commit | a91b0d27806226d52db90a4fe83bb73a95f412f4 (patch) | |
tree | 25b4ff3867b2a3195f51061a3be01d4244c33f25 /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | |
parent | 8830e3802a92dca1d08048ac1197d9b0542db048 (diff) | |
download | llvm-a91b0d27806226d52db90a4fe83bb73a95f412f4.zip llvm-a91b0d27806226d52db90a4fe83bb73a95f412f4.tar.gz llvm-a91b0d27806226d52db90a4fe83bb73a95f412f4.tar.bz2 |
[PowerPC] hoist xxspltiw instruction out of the loop with FMA mutation pass. (#111696)
Summary:
The patch fixes the issue [[PowerPC] missing VSX FMA Mutation optimize
in some case for option -schedule-ppc-vsx-fma-mutation-early
#111906](https://github.com/llvm/llvm-project/issues/111906)
In certain cases, the Register Coalescer pass—which eliminates COPY
instructions—can interfere with the PowerPC VSX FMA Mutation pass.
Specifically, it can prevent the mutation of a COPY adjacent to an
XSMADDADP into a single XSMADDMDP instruction. As a result, the xxspltiw
instruction is not hoisted out of the loop as expected, leading to
missed optimization opportunities.
To address this, the patch ensures that the `VSX FMA Mutation` pass runs
before the `Register Coalescer` pass when the
-schedule-ppc-vsx-fma-mutation-early option is enabled.
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index ff600d7..359a43d 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -559,7 +559,8 @@ void PPCPassConfig::addMachineSSAOptimization() { void PPCPassConfig::addPreRegAlloc() { if (getOptLevel() != CodeGenOptLevel::None) { - insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID, + insertPass(VSXFMAMutateEarly ? &TwoAddressInstructionPassID + : &MachineSchedulerID, &PPCVSXFMAMutateID); } |