[llvm] [X86] canCreateUndefOrPoisonForTargetNode/isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::VPERMILPV handling (PR #160849)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 03:25:05 PDT 2025
https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/160849
X86ISD::VPERMILPV shuffles can't create undef/poison itself, allowing us to fold freeze(vpermilps(x,y)) -> vpermilps(freeze(x),freeze(y))
>From e8f31cf4ce77fdac4acfd22bd1a1d7f2e0b34696 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Fri, 26 Sep 2025 11:23:45 +0100
Subject: [PATCH] [X86]
canCreateUndefOrPoisonForTargetNode/isGuaranteedNotToBeUndefOrPoisonForTargetNode
- add X86ISD::VPERMILPV handling
X86ISD::PSHUFB shuffles can't create undef/poison itself, allowing us to fold freeze(vpermilps(x,y)) -> vpermilps(freeze(x),freeze(y))
---
llvm/lib/Target/X86/X86ISelLowering.cpp | 2 ++
llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 57cf66e5275e3..633094df297d6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -45188,6 +45188,7 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
case X86ISD::PSHUFD:
case X86ISD::UNPCKL:
case X86ISD::UNPCKH:
+ case X86ISD::VPERMILPV:
case X86ISD::VPERMILPI:
case X86ISD::VPERMV3: {
SmallVector<int, 8> Mask;
@@ -45254,6 +45255,7 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
case X86ISD::PSHUFD:
case X86ISD::UNPCKL:
case X86ISD::UNPCKH:
+ case X86ISD::VPERMILPV:
case X86ISD::VPERMILPI:
case X86ISD::VPERMV3:
return false;
diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll
index c9d9db6cc9578..3279a50a1265b 100644
--- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll
+++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll
@@ -373,8 +373,6 @@ define <8 x float> @constant_fold_vpermilvar_ps_256() {
define <8 x float> @freeze_vpermilvar_ps_256(<8 x float> %a0) {
; CHECK-LABEL: freeze_vpermilvar_ps_256:
; CHECK: # %bb.0:
-; CHECK-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,3,1,2,7,6,5,4]
-; CHECK-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,2,3,1,7,6,5,4]
; CHECK-NEXT: ret{{[l|q]}}
%s0 = call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %a0, <8 x i32> <i32 0, i32 3, i32 1, i32 2, i32 7, i32 6, i32 5, i32 4>)
%f0 = freeze <8 x float> %s0
More information about the llvm-commits
mailing list