[llvm] [PPC] Constrain register in VSPLT of XXSLDWI transform (PR #208005)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 05:49:44 PDT 2026


================
@@ -889,6 +889,8 @@ bool PPCMIPeephole::simplifyCode() {
             LLVM_DEBUG(dbgs() << "Changing splat immediate from " << SplatImm
                               << " to " << NewElem << " in instruction: ");
             LLVM_DEBUG(MI.dump());
+            if (!MRI->constrainRegClass(ShiftOp1, &PPC::VRRCRegClass))
----------------
nikic wrote:

Not sure what you mean here. Usually XXSLDWI is removed and we use its input register directly in VSPLT, which requires vrrc class. If XXSLDWI has multiple uses it can be retained, in which case the register is going to be used both by XXSLDWI (requires vsrc) and VSPLT (requires vrrc). We can satisfy both by using a vrrc register.

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


More information about the llvm-commits mailing list