[llvm] [IR] Fix UB on Op<2> in ShuffleVector predicates (PR #75549)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 16:26:09 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Reid Kleckner (rnk)
<details>
<summary>Changes</summary>
This Op<2> usage was missed in 1ee6ec2bf3, which replaced the third shuffle operand with a vector of integer mask constants.
I noticed this when attempting to make changes to the layout of llvm::Value.
---
Full diff: https://github.com/llvm/llvm-project/pull/75549.diff
1 Files Affected:
- (modified) llvm/lib/IR/Instructions.cpp (+1-8)
``````````diff
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index bc228a577c6a6c..299b4e74677dcc 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -2412,9 +2412,6 @@ bool ShuffleVectorInst::isInsertSubvectorMask(ArrayRef<int> Mask,
}
bool ShuffleVectorInst::isIdentityWithPadding() const {
- if (isa<UndefValue>(Op<2>()))
- return false;
-
// FIXME: Not currently possible to express a shuffle mask for a scalable
// vector for this case.
if (isa<ScalableVectorType>(getType()))
@@ -2439,9 +2436,6 @@ bool ShuffleVectorInst::isIdentityWithPadding() const {
}
bool ShuffleVectorInst::isIdentityWithExtract() const {
- if (isa<UndefValue>(Op<2>()))
- return false;
-
// FIXME: Not currently possible to express a shuffle mask for a scalable
// vector for this case.
if (isa<ScalableVectorType>(getType()))
@@ -2457,8 +2451,7 @@ bool ShuffleVectorInst::isIdentityWithExtract() const {
bool ShuffleVectorInst::isConcat() const {
// Vector concatenation is differentiated from identity with padding.
- if (isa<UndefValue>(Op<0>()) || isa<UndefValue>(Op<1>()) ||
- isa<UndefValue>(Op<2>()))
+ if (isa<UndefValue>(Op<0>()) || isa<UndefValue>(Op<1>()))
return false;
// FIXME: Not currently possible to express a shuffle mask for a scalable
``````````
</details>
https://github.com/llvm/llvm-project/pull/75549
More information about the llvm-commits
mailing list