[llvm] [X86] getFauxShuffleMask - OR(BITCAST(SHUFFLE()),BITCAST(SHUFFLE())) patterns should return bitcasted source values (PR #134993)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 04:21:58 PDT 2025


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/134993

Noticed while investigating #133947 regressions - if we peek through bitcasts we can lose track of oneuse/combined nodes in shuffle combining

Currently the same codegen as combineX86ShufflesRecursively still peeks through the bitcasts itself, but we will soon handle this consistently as another part of #133947

>From 7f9d0068cf53ca761c4e1843e56e4137d7855a70 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Wed, 9 Apr 2025 12:20:30 +0100
Subject: [PATCH] [X86] getFauxShuffleMask -
 OR(BITCAST(SHUFFLE()),BITCAST(SHUFFLE())) patterns should return bitcasted
 source values

Noticed while investigating #133947 regressions - if we peek through bitcasts we can lose track of oneuse/combined nodes

Same current codegen as combineX86ShufflesRecursively still peeks through the bitcasts itself, but we will soon handle this consistently as another part of #133947
---
 llvm/lib/Target/X86/X86ISelLowering.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 47ac1ee571269..53bed634c3cc6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -6155,8 +6155,8 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
       else
         return false;
     }
-    Ops.push_back(N0);
-    Ops.push_back(N1);
+    Ops.push_back(N.getOperand(0));
+    Ops.push_back(N.getOperand(1));
     return true;
   }
   case ISD::CONCAT_VECTORS: {



More information about the llvm-commits mailing list