[llvm] [InstCombine] Explicitly match poison operand. NFCI (PR #141744)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 03:53:05 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Luke Lau (lukel97)
<details>
<summary>Changes</summary>
This is a follow up from https://github.com/llvm/llvm-project/pull/141300#discussion_r2109109224
An undef mask element in a shufflevector is really poison, so explicitly match it here for clarity.
---
Full diff: https://github.com/llvm/llvm-project/pull/141744.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index e01dafd36d30d..e101edf4a6208 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1422,7 +1422,7 @@ InstCombinerImpl::foldShuffledIntrinsicOperands(IntrinsicInst *II) {
ArrayRef<int> Mask;
auto *NonConstArg = find_if_not(II->args(), IsaPred<Constant>);
if (!NonConstArg ||
- !match(NonConstArg, m_Shuffle(m_Value(X), m_Undef(), m_Mask(Mask))))
+ !match(NonConstArg, m_Shuffle(m_Value(X), m_Poison(), m_Mask(Mask))))
return nullptr;
// At least 1 operand must have 1 use because we are creating 2 instructions.
@@ -1433,7 +1433,7 @@ InstCombinerImpl::foldShuffledIntrinsicOperands(IntrinsicInst *II) {
SmallVector<Value *, 4> NewArgs;
Type *SrcTy = X->getType();
for (Value *Arg : II->args()) {
- if (match(Arg, m_Shuffle(m_Value(X), m_Undef(), m_SpecificMask(Mask))) &&
+ if (match(Arg, m_Shuffle(m_Value(X), m_Poison(), m_SpecificMask(Mask))) &&
X->getType() == SrcTy)
NewArgs.push_back(X);
else if (match(Arg, m_ImmConstant(C))) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/141744
More information about the llvm-commits
mailing list