← Back

Agent Trajectory

Conversation timeline with tool traces and model turns
Total Rounds
29
Phase 1 Analyze
8
Phase 2 Validate
21
Total Tokens
1,948,609
Tool Call Distribution
verify x 9difftest x 7grep250 x 4tests_manager x 4langref x 3read250 x 3find250 x 2report x 1stop x 1

SYSTEM

You are an LLVM compiler expert specializing in test case generation and bug detection. You are conducting LLVM code review now.

## Context
Maintainers provided a patch, but patches often have edge cases or introduce new issues.

## Your Task
You will work in two phases:
- Phase 1: Analyze the fix to identify potential issues, gaps, and edge cases. Propose test strategies.
- Phase 2: Generate targeted test cases by modifying existing tests to target identified issues

## You Will Receive
- Original patch description and related test case(s)
- The code region that was modified (the patch)
- Information about the optimization pass and component involved

## Tools You Can Use

You have multiple tools for each phase, but you should try to avoid using them with same inputs repeatedly to reduce redundant calls.

**CRITICAL**: You MUST use tool call every action in Phase 1 and Phase 2.

USER

# Phase 1: Analyze the Fix

This is a patch for InstCombine:

[InstCombine]Fold bitcast shuffle ashr v2i64
This patch folds the X86 pre-AVX512 64-bit vector arithmetic shift emulation pattern (`bitcast(shuffle(ashr(bitcast(X))))`) into a single `ashr` instruction. The transformation is implemented in InstCombine, the middle-end optimization pass, so it benefits all backends (X86, ARM, RISC-V, etc.) by cleaning up the IR before it reaches any target-specific lowering.

Alive2 proof: https://alive2.llvm.org/ce/z/LM1Eu1

Fixes: #125189
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 7e747ddb9013e..f2741e07730e6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -3303,7 +3303,65 @@ static Value *foldCopySignIdioms(BitCastInst &CI,
 
   return Builder.CreateCopySign(Builder.CreateBitCast(Y, FTy), X);
 }
+/// Fold bitcast(shuffle(ashr(bitcast(X)))) to wide ashr.
+/// This pattern is generated by pre-AVX512 X86 backends to emulate
+/// 64-bit vector arithmetic shifts.
+///
+/// Fixes llvm/llvm-project#125189.
+static Instruction *
+foldBitcastShuffleAShrToWideAShr(BitCastInst &BC,
+                                 InstCombiner::BuilderTy &Builder) {
+  auto *DstTy = dyn_cast<FixedVectorType>(BC.getType());
+  auto *SrcTy = dyn_cast<FixedVectorType>(BC.getOperand(0)->getType());
+  if (!DstTy || !SrcTy)
+    return nullptr;
+
+  auto *Ti = dyn_cast<IntegerType>(DstTy->getElementType());
+  auto *Tj = dyn_cast<IntegerType>(SrcTy->getElementType());
+  if (!Ti || !Tj)
+    return nullptr;
+
+  unsigned N = DstTy->getNumElements();
+  unsigned W = Ti->getBitWidth();
+  unsigned Half = W / 2;
 
+  if (SrcTy->getNumElements() != 2 * N || Tj->getBitWidth() != Half || W < 4)
+    return nullptr;
+
+  Value *X;
+  Constant *ShiftVec;
+  ArrayRef<int> Mask;
+
+  if (!match(BC.getOperand(0),
+             m_Shuffle(m_AShr(m_BitCast(m_Value(X)), m_Constant(ShiftVec)),
+                       m_CombineOr(m_Poison(), m_Undef()), m_Mask(Mask))))
+    return nullptr;
+
+  if (X->getType() != DstTy)
+    return nullptr;
+
+  // Pattern: shift[2k] = 0, shift[2k+1] = Half-1
+  //          mask[2k] = mask[2k+1] = 2k+1
+  for (unsigned i = 0; i < N; ++i) {
+    unsigned Lo = 2 * i;
+    unsigned Hi = 2 * i + 1;
+
+    auto *ShiftLo =
+        dyn_cast_or_null<ConstantInt>(ShiftVec->getAggregateElement(Lo));
+    auto *ShiftHi =
+        dyn_cast_or_null<ConstantInt>(ShiftVec->getAggregateElement(Hi));
+    if (!ShiftLo || !ShiftHi || !ShiftLo->isZero() ||
+        ShiftHi->getZExtValue() != Half - 1)
+      return nullptr;
+
+    if (Mask[Lo] != (int)Hi || Mask[Hi] != (int)Hi)
+      return nullptr;
+  }
+
+  Constant *SplatAmt = ConstantVector::getSplat(ElementCount::getFixed(N),
+                                                ConstantInt::get(Ti, W - 1));
+  return BinaryOperator::CreateAShr(X, SplatAmt);
+}
 Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
   // If the operands are integer typed then apply the integer transforms,
   // otherwise just apply the common ones.
@@ -3444,6 +3502,9 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
   if (Instruction *I = foldBitCastSelect(CI, Builder))
     return I;
 
+  if (Instruction *I = foldBitcastShuffleAShrToWideAShr(CI, Builder))
+    return I;
+
   if (Value *V = foldCopySignIdioms(CI, Builder, SQ.getWithInstruction(&CI)))
     return replaceInstUsesWith(CI, V);
 


---

## Subsystem Knowledge for InstCombine

For reference, here are some key points about the InstCombine you should consider (but do not limit to these) in your analysis:

# Subsystem Knowledge for InstCombine

## Elements Frequently Missed

*   **Poison-Generating Flags (`nsw`, `nuw`, `exact`, `inbounds`, `disjoint`, `samesign`)**: These flags are frequently retained when instructions are moved, reassociated, or when their guarding conditions (like `select` instructions) are removed. The optimization pass misses that the conditions guaranteeing these flags may no longer hold in the new context, leading to incorrect poison generation.
*   **Fast-Math Flags (`nnan`, `ninf`, `nsz`)**: The pass frequently misses the semantic differences of these flags across different instruction types (e.g., `select` vs. `minnum`/`maxnum` or binary operators). It often blindly copies or propagates these flags from inner to outer operations, or from conditional to unconditional operations, without properly intersecting them.
*   **UB-Implying Attributes (`noundef`, `range`)**: When intrinsics or instructions are relaxed to return `poison` for edge cases, or when their operands are simplified, the pass frequently forgets to drop attributes that escalate `poison` to immediate Undefined Behavior (UB).
*   **NaN Sign Bits and Payloads**: The pass frequently misses the requirement to preserve the sign bit and payload of NaN values. Optimizations like folding conditional negations to `fabs` or simplifying based on demanded floating-point classes often incorrectly overwrite or clear the NaN sign bit.
*   **Undef vs. Poison Semantics**: The pass frequently conflates `undef` and `poison`. It misses that `undef` can evaluate to different values at different use sites (e.g., in masked merges or vector selects) and incorrectly upgrades `undef` to `poison`, or treats `poison` as a safe wildcard (e.g., matching a zero-broadcast mask).
*   **Pointer Provenance**: When simplifying pointer comparisons (e.g., replacing one pointer with another because they compare equal), the pass frequently misses that pointers with the same address can have different provenances, leading to invalid memory access assumptions.
*   **Multi-Use Instruction Contexts**: When performing Known Bits or Demanded Bits analysis, the pass frequently misses checking if an instruction has multiple uses. It erroneously applies context-specific constraints (valid only at one use site) to simplify the root instruction globally.
*   **Non-Power-of-Two Integer Widths**: The pass frequently assumes that bitwise masking tricks (like using `BitWidth - 1` as a mask) work universally, missing the fact that these mathematical equivalences break down for non-power-of-two integer types (e.g., `i33`).
*   **Vector Lane-Crossing Dependencies**: In vector optimizations, the pass frequently misses that lane-crossing operations (like `shufflevector`) break element-wise assumptions. It incorrectly applies scalar known-bits or demanded-elements logic to individual lanes without accounting for cross-lane data movement.

## Patterns Not Well Handled

### Pattern 1: Unconditional Execution of Conditionally Guarded Operations
The optimization pass struggles when converting conditional control flow (like `select` instructions or short-circuiting logical AND/OR) into unconditional sequences (like bitwise AND/OR, `umax`, or direct arithmetic). The core issue is that the original condition acts as a guard against poison-generating flags, UB-implying attributes, or out-of-bounds operands. When the pass folds the pattern, it frequently reuses the original instructions but fails to strip flags like `nsw`, `samesign`, or `range`. Consequently, edge-case inputs that were previously bypassed now unconditionally execute the flagged instructions, propagating `poison` or triggering UB.

### Pattern 2: Invalid Fast-Math Flag Propagation in Floating-Point Folds
High-level floating-point simplifications—such as folding a `select` into a binary operator, converting conditional negations to `fabs`, or commuting truncations with intrinsics—are not well handled regarding Fast-Math Flags (FMF). The pass often takes the union of flags or blindly copies flags from a conditionally executed instruction to an unconditionally executed one. This causes the optimized code to make overly aggressive assumptions (e.g., assuming no infinities or NaNs) on paths where those assumptions are invalid, leading to miscompilations that violate strict IEEE-754 semantics.

### Pattern 3: Context-Leakage in Multi-Use Instruction Simplification
The pass does not well handle the simplification of root instructions that have multiple uses across different basic blocks. When optimizations like Demanded Bits or Known Bits are triggered from a specific use site, the pass may utilize local dominating conditions (e.g., an `icmp` guard or `llvm.assume`). However, it incorrectly applies these local facts to modify the shared root instruction in-place. This leaks context-specific assumptions to all other uses of the instruction, corrupting the data flow for execution paths that do not share those constraints.

### Pattern 4: Unsafe Pointer Arithmetic and Comparison Canonicalization
Patterns involving the reassociation, merging, or comparison of `getelementptr` (GEP) instructions are frequently mishandled when no-wrap guarantees are absent or mixed. For example, the pass attempts to merge GEPs with mixed-sign offsets while retaining the `inbounds` flag, failing to realize that intermediate calculations might temporarily step out of bounds. Similarly, it folds pointer comparisons into direct integer/index comparisons without verifying `nuw`/`nusw` flags or accounting for `inttoptr` truncations, ignoring the fact that pointer arithmetic can wrap around the address space.

### Pattern 5: Mishandling of Poison/Undef in Vector Lane Operations
Vector transformations involving `shufflevector`, vector `select`s, and vector constants are highly prone to bugs when `poison` or `undef` elements are present. The pass often attempts to distribute operations across `select` branches or deduplicate binary operations by matching shuffle masks. However, it fails to handle the propagation of `poison` correctly—such as treating a `poison` lane as a safe `0` for deduplication, or unconditionally propagating a `poison` constant when a guarding vector `select` is removed. Additionally, it incorrectly assumes `undef` conditions in vector selects evaluate to a specific boolean value, leading to overly aggressive dead-code elimination.

### Pattern 6: Speculation and Hoisting of Non-Speculatable Instructions
The pass does not well handle the movement or operand substitution of non-speculatable instructions (like integer division, remainder, or memory loads). Patterns that attempt to sink a division after a `select`, hoist an `extractelement` above a division, or substitute a variable operand with a constant based on a conditional check frequently introduce immediate Undefined Behavior. The pass fails to recognize that the transformation exposes the non-speculatable instruction to `poison` values, out-of-bounds indices, or zero divisors that were safely masked or guarded in the original control flow.

**CRITICAL**: Subsystem knowledge is **ONLY** a reference for you to understand this component.
Do NOT start your analysis from these patterns. Start from the patch semantics. Use these **ONLY** to cross-check your reasoning.

## Your Task for Phase 1

In this phase, you will review and analyze the fix above carefully and identify potential issues, edge cases, or gaps that the fix might miss. According to the analysis, propose mutation strategies for exposing the issue. These strategies will be used in Phase 2 to mutate existing test cases to target the identified issues.

Follow this structured workflow:

### Step 1: Context Gathering
In this step, you should gather enough context to construct semantics model of this fix for future analysis. Your goal is to understand the complete flow of this optimization. To achieve this, you should look at the nearby code regions, or try to find similar code regions in the LLVM codebase to understand the semantics of this fix.

You can use search tools:
- Use the `find` and `list` tools to find relevant files in the LLVM code.
- Use the `read` and `grep` tools to understand the context of the fix.

### Step 2: Fix Segmentation and Analysis
Based on the model built for this fix, you should segment the fix into smaller parts and analyze the semantics of each part. Follow this structured workflow for segmentation and analysis:

- **Segmentation**: Break down the fix into smaller segments or key changes, especially focusing on code regions related to semantics changes.
- **Analysis**: For each segment, analyze the semantics and identify any assumptions or preconditions that the fix relies on.

#### Tips for this step
- You can use the `langref` tool to query the LLVM Language Reference Manual for specific instructions, semantics, or optimization details relevant to the fix.
- You can pay attention to the commit message and annotations in the code, such as comments or specific patterns that indicate important semantics or assumptions.

### Step 3: Formal Semantic Modeling
- Define the exact semantic contract that this fix claims to satisfy.
- Explicitly list the preconditions under which the contract is assumed to hold.
- Identify how these preconditions may be violated.

### Step 4: Identify Potential Issues and Propose Test Strategies
Based on your analysis, propose around 5 specific test strategies that can be used to expose the issue. When proposing test strategies, consider the following:
- **Focus**: Focus on the assumptions and preconditions you identified.
- **Scenarios**: Think about specific input characteristics or scenarios that could violate these assumptions.
- **Mutations**: Propose mutations that can be applied to existing test cases to create new test cases targeting these scenarios.

Once you have analyzed the fix and identified potential issues or edge cases, use the `stop` tool to specify proposed test strategies along with detailed reasoning. 
Follow this structure for reasoning:

### 1. Fix Understanding
- What optimization or transformation does this fix enable or correct?
- What are the key changes made in the patch?

### 2. Formal Semantic Modeling
- What is the exact semantic function before the fix?
- What is the exact semantic function after the fix?
- Under what conditions might they differ?
- Provide at least one concrete numerical instantiation to illustrate the difference.

### 3. Assumptions and Preconditions Identified
- What assumptions does the fix make about the input?
- What preconditions must hold for this fix to be correct?

### 4. Potential Cases to Break Assumptions
For each assumption and precondition identified, describe specific scenarios or input characteristics that could violate them. The potential cases should only focus on the semantics related to the analysis above.

### 5. Test Strategies
For each potential issue you identified, propose specific test strategies with the following structure:

- Name: [Name]
- Target: [What to mutate]
- Rationale: [Why this might expose an issue]
- Expected Issue: [What incorrect behavior might occur]

---

## Tools that you can use

- `findN`: Search for files in the LLVM codebase related to the component or optimization pass to understand the context of the fix and find relevant tests.
- `listN`: List files in the LLVM codebase to find relevant tests or code regions.
- `readN`: Read the content of a file in the LLVM codebase to understand existing tests or the fix.
- `grepN`: Search for specific patterns in the codebase to find relevant tests or code regions.
- `langref`: Query the LLVM Language Reference Manual for specific instructions, semantics, or optimization details relevant to the fix.
- `stop`: End Phase 1 by submitting the identified issues and proposed test strategies.

TOOL CALL: read250

{"file":"llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp","position":3260}

TOOL OUTPUT

file: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3260-3510
--------------------------------------------------------------------
3260           cast<BitCastInst>(Builder.CreateBitCast(NewPN, SrcTy));
3261         SI->setOperand(0, NewBC);
3262         Worklist.push(SI);
3263         assert(hasStoreUsersOnly(*NewBC));
3264       }
3265       else if (auto *BCI = dyn_cast<BitCastInst>(V)) {
3266         Type *TyB = BCI->getOperand(0)->getType();
3267         Type *TyA = BCI->getType();
3268         assert(TyA == DestTy && TyB == SrcTy);
3269         (void) TyA;
3270         (void) TyB;
3271         Instruction *I = replaceInstUsesWith(*BCI, NewPN);
3272         if (BCI == &CI)
3273           RetVal = I;
3274       } else if (auto *PHI = dyn_cast<PHINode>(V)) {
3275         assert(OldPhiNodes.contains(PHI));
3276         (void) PHI;
3277       } else {
3278         llvm_unreachable("all uses should be handled");
3279       }
3280     }
3281   }
3282 
3283   return RetVal;
3284 }
3285 
3286 /// Fold (bitcast (or (and (bitcast X to int), signmask), nneg Y) to fp) to
3287 /// copysign((bitcast Y to fp), X)
3288 static Value *foldCopySignIdioms(BitCastInst &CI,
3289                                  InstCombiner::BuilderTy &Builder,
3290                                  const SimplifyQuery &SQ) {
3291   Value *X, *Y;
3292   Type *FTy = CI.getType();
3293   if (!FTy->isFPOrFPVectorTy())
3294     return nullptr;
3295   if (!match(&CI, m_ElementWiseBitCast(m_c_Or(
3296                       m_And(m_ElementWiseBitCast(m_Value(X)), m_SignMask()),
3297                       m_Value(Y)))))
3298     return nullptr;
3299   if (X->getType() != FTy)
3300     return nullptr;
3301   if (!isKnownNonNegative(Y, SQ))
3302     return nullptr;
3303 
3304   return Builder.CreateCopySign(Builder.CreateBitCast(Y, FTy), X);
3305 }
3306 /// Fold bitcast(shuffle(ashr(bitcast(X)))) to wide ashr.
3307 /// This pattern is generated by pre-AVX512 X86 backends to emulate
3308 /// 64-bit vector arithmetic shifts.
3309 ///
3310 /// Fixes llvm/llvm-project#125189.
3311 static Instruction *
3312 foldBitcastShuffleAShrToWideAShr(BitCastInst &BC,
3313                                  InstCombiner::BuilderTy &Builder) {
3314   auto *DstTy = dyn_cast<FixedVectorType>(BC.getType());
3315   auto *SrcTy = dyn_cast<FixedVectorType>(BC.getOperand(0)->getType());
3316   if (!DstTy || !SrcTy)
3317     return nullptr;
3318 
3319   auto *Ti = dyn_cast<IntegerType>(DstTy->getElementType());
3320   auto *Tj = dyn_cast<IntegerType>(SrcTy->getElementType());
3321   if (!Ti || !Tj)
3322     return nullptr;
3323 
3324   unsigned N = DstTy->getNumElements();
3325   unsigned W = Ti->getBitWidth();
3326   unsigned Half = W / 2;
3327 
3328   if (SrcTy->getNumElements() != 2 * N || Tj->getBitWidth() != Half || W < 4)
3329     return nullptr;
3330 
3331   Value *X;
3332   Constant *ShiftVec;
3333   ArrayRef<int> Mask;
3334 
3335   if (!match(BC.getOperand(0),
3336              m_Shuffle(m_AShr(m_BitCast(m_Value(X)), m_Constant(ShiftVec)),
3337                        m_CombineOr(m_Poison(), m_Undef()), m_Mask(Mask))))
3338     return nullptr;
3339 
3340   if (X->getType() != DstTy)
3341     return nullptr;
3342 
3343   // Pattern: shift[2k] = 0, shift[2k+1] = Half-1
3344   //          mask[2k] = mask[2k+1] = 2k+1
3345   for (unsigned i = 0; i < N; ++i) {
3346     unsigned Lo = 2 * i;
3347     unsigned Hi = 2 * i + 1;
3348 
3349     auto *ShiftLo =
3350         dyn_cast_or_null<ConstantInt>(ShiftVec->getAggregateElement(Lo));
3351     auto *ShiftHi =
3352         dyn_cast_or_null<ConstantInt>(ShiftVec->getAggregateElement(Hi));
3353     if (!ShiftLo || !ShiftHi || !ShiftLo->isZero() ||
3354         ShiftHi->getZExtValue() != Half - 1)
3355       return nullptr;
3356 
3357     if (Mask[Lo] != (int)Hi || Mask[Hi] != (int)Hi)
3358       return nullptr;
3359   }
3360 
3361   Constant *SplatAmt = ConstantVector::getSplat(ElementCount::getFixed(N),
3362                                                 ConstantInt::get(Ti, W - 1));
3363   return BinaryOperator::CreateAShr(X, SplatAmt);
3364 }
3365 Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
3366   // If the operands are integer typed then apply the integer transforms,
3367   // otherwise just apply the common ones.
3368   Value *Src = CI.getOperand(0);
3369   Type *SrcTy = Src->getType();
3370   Type *DestTy = CI.getType();
3371 
3372   // Get rid of casts from one type to the same type. These are useless and can
3373   // be replaced by the operand.
3374   if (DestTy == Src->getType())
3375     return replaceInstUsesWith(CI, Src);
3376 
3377   if (isa<FixedVectorType>(DestTy)) {
3378     if (isa<IntegerType>(SrcTy)) {
3379       // If this is a cast from an integer to vector, check to see if the input
3380       // is a trunc or zext of a bitcast from vector.  If so, we can replace all
3381       // the casts with a shuffle and (potentially) a bitcast.
3382       if (isa<TruncInst>(Src) || isa<ZExtInst>(Src)) {
3383         CastInst *SrcCast = cast<CastInst>(Src);
3384         if (BitCastInst *BCIn = dyn_cast<BitCastInst>(SrcCast->getOperand(0)))
3385           if (isa<VectorType>(BCIn->getOperand(0)->getType()))
3386             if (Instruction *I = optimizeVectorResizeWithIntegerBitCasts(
3387                     BCIn->getOperand(0), cast<VectorType>(DestTy), *this))
3388               return I;
3389       }
3390 
3391       // If the input is an 'or' instruction, we may be doing shifts and ors to
3392       // assemble the elements of the vector manually.  Try to rip the code out
3393       // and replace it with insertelements.
3394       if (Value *V = optimizeIntegerToVectorInsertions(CI, *this))
3395         return replaceInstUsesWith(CI, V);
3396     }
3397   }
3398 
3399   if (FixedVectorType *SrcVTy = dyn_cast<FixedVectorType>(SrcTy)) {
3400     if (SrcVTy->getNumElements() == 1) {
3401       // If our destination is not a vector, then make this a straight
3402       // scalar-scalar cast.
3403       if (!DestTy->isVectorTy()) {
3404         Value *Elem =
3405           Builder.CreateExtractElement(Src,
3406                      Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
3407         return CastInst::Create(Instruction::BitCast, Elem, DestTy);
3408       }
3409 
3410       // Otherwise, see if our source is an insert. If so, then use the scalar
3411       // component directly:
3412       // bitcast (inselt <1 x elt> V, X, 0) to <n x m> --> bitcast X to <n x m>
3413       if (auto *InsElt = dyn_cast<InsertElementInst>(Src))
3414         return new BitCastInst(InsElt->getOperand(1), DestTy);
3415     }
3416 
3417     // Convert an artificial vector insert into more analyzable bitwise logic.
3418     unsigned BitWidth = DestTy->getScalarSizeInBits();
3419     Value *X, *Y;
3420     uint64_t IndexC;
3421     if (match(Src, m_OneUse(m_InsertElt(m_OneUse(m_BitCast(m_Value(X))),
3422                                         m_Value(Y), m_ConstantInt(IndexC)))) &&
3423         DestTy->isIntegerTy() && X->getType() == DestTy &&
3424         Y->getType()->isIntegerTy() && isDesirableIntType(BitWidth)) {
3425       // Adjust for big endian - the LSBs are at the high index.
3426       if (DL.isBigEndian())
3427         IndexC = SrcVTy->getNumElements() - 1 - IndexC;
3428 
3429       // We only handle (endian-normalized) insert to index 0. Any other insert
3430       // would require a left-shift, so that is an extra instruction.
3431       if (IndexC == 0) {
3432         // bitcast (inselt (bitcast X), Y, 0) --> or (and X, MaskC), (zext Y)
3433         unsigned EltWidth = Y->getType()->getScalarSizeInBits();
3434         APInt MaskC = APInt::getHighBitsSet(BitWidth, BitWidth - EltWidth);
3435         Value *AndX = Builder.CreateAnd(X, MaskC);
3436         Value *ZextY = Builder.CreateZExt(Y, DestTy);
3437         return BinaryOperator::CreateOr(AndX, ZextY);
3438       }
3439     }
3440   }
3441 
3442   if (auto *Shuf = dyn_cast<ShuffleVectorInst>(Src)) {
3443     // Okay, we have (bitcast (shuffle ..)).  Check to see if this is
3444     // a bitcast to a vector with the same # elts.
3445     Value *ShufOp0 = Shuf->getOperand(0);
3446     Value *ShufOp1 = Shuf->getOperand(1);
3447     auto ShufElts = cast<VectorType>(Shuf->getType())->getElementCount();
3448     auto SrcVecElts = cast<VectorType>(ShufOp0->getType())->getElementCount();
3449     if (Shuf->hasOneUse() && DestTy->isVectorTy() &&
3450         cast<VectorType>(DestTy)->getElementCount() == ShufElts &&
3451         ShufElts == SrcVecElts) {
3452       BitCastInst *Tmp;
3453       // If either of the operands is a cast from CI.getType(), then
3454       // evaluating the shuffle in the casted destination's type will allow
3455       // us to eliminate at least one cast.
3456       if (((Tmp = dyn_cast<BitCastInst>(ShufOp0)) &&
3457            Tmp->getOperand(0)->getType() == DestTy) ||
3458           ((Tmp = dyn_cast<BitCastInst>(ShufOp1)) &&
3459            Tmp->getOperand(0)->getType() == DestTy)) {
3460         Value *LHS = Builder.CreateBitCast(ShufOp0, DestTy);
3461         Value *RHS = Builder.CreateBitCast(ShufOp1, DestTy);
3462         // Return a new shuffle vector.  Use the same element ID's, as we
3463         // know the vector types match #elts.
3464         return new ShuffleVectorInst(LHS, RHS, Shuf->getShuffleMask());
3465       }
3466     }
3467 
3468     // A bitcasted-to-scalar and byte/bit reversing shuffle is better recognized
3469     // as a byte/bit swap:
3470     // bitcast <N x i8> (shuf X, undef, <N, N-1,...0>) -> bswap (bitcast X)
3471     // bitcast <N x i1> (shuf X, undef, <N, N-1,...0>) -> bitreverse (bitcast X)
3472     if (DestTy->isIntegerTy() && ShufElts.getKnownMinValue() % 2 == 0 &&
3473         Shuf->hasOneUse() && Shuf->isReverse() && match(ShufOp1, m_Poison())) {
3474       unsigned IntrinsicNum = 0;
3475       if (DL.isLegalInteger(DestTy->getScalarSizeInBits()) &&
3476           SrcTy->getScalarSizeInBits() == 8) {
3477         IntrinsicNum = Intrinsic::bswap;
3478       } else if (SrcTy->getScalarSizeInBits() == 1) {
3479         IntrinsicNum = Intrinsic::bitreverse;
3480       }
3481       if (IntrinsicNum != 0) {
3482         assert(ShufOp0->getType() == SrcTy && "Unexpected shuffle mask");
3483         Function *BswapOrBitreverse = Intrinsic::getOrInsertDeclaration(
3484             CI.getModule(), IntrinsicNum, DestTy);
3485         Value *ScalarX = Builder.CreateBitCast(ShufOp0, DestTy);
3486         return CallInst::Create(BswapOrBitreverse, {ScalarX});
3487       }
3488     }
3489   }
3490 
3491   // Handle the A->B->A cast, and there is an intervening PHI node.
3492   if (PHINode *PN = dyn_cast<PHINode>(Src))
3493     if (Instruction *I = optimizeBitCastFromPhi(CI, PN))
3494       return I;
3495 
3496   if (Instruction *I = canonicalizeBitCastExtElt(CI, *this))
3497     return I;
3498 
3499   if (Instruction *I = foldBitCastBitwiseLogic(CI, Builder))
3500     return I;
3501 
3502   if (Instruction *I = foldBitCastSelect(CI, Builder))
3503     return I;
3504 
3505   if (Instruction *I = foldBitcastShuffleAShrToWideAShr(CI, Builder))
3506     return I;
3507 
3508   if (Value *V = foldCopySignIdioms(CI, Builder, SQ.getWithInstruction(&CI)))
3509     return replaceInstUsesWith(CI, V);
--------------------------------------------------------------------

TOOL CALL: grep250

{"args":"-nRI 'foldBitcastShuffleAShrToWideAShr\\|bitcast(shuffle(ashr\\|ashr.*shufflevector\\|shufflevector.*ashr' llvm/test llvm/lib/Transforms/InstCombine","k":1}

TOOL OUTPUT

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3306:/// Fold bitcast(shuffle(ashr(bitcast(X)))) to wide ashr.
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3312:foldBitcastShuffleAShrToWideAShr(BitCastInst &BC,
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3505:  if (Instruction *I = foldBitcastShuffleAShrToWideAShr(CI, Builder))

TOOL CALL: find250

{"directory":"llvm/test/Transforms/InstCombine","pattern":"**/*cast*"}

TOOL OUTPUT

Error: The following required parameters are missing: k

TOOL CALL: langref

{"inst":"shufflevector"}

TOOL OUTPUT

.. _i_shufflevector:

'``shufflevector``' Instruction
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

      <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask>    ; yields <m x <ty>>
      <result> = shufflevector <vscale x n x <ty>> <v1>, <vscale x n x <ty>> v2, <vscale x m x i32> <mask>  ; yields <vscale x m x <ty>>

Overview:
"""""""""

The '``shufflevector``' instruction constructs a permutation of elements
from two input vectors, returning a vector with the same element type as
the input and length that is the same as the shuffle mask.

Arguments:
""""""""""

The first two operands of a '``shufflevector``' instruction are vectors
with the same type. The third argument is a shuffle mask vector constant
whose element type is ``i32``. The mask vector elements must be constant
integers or ``poison`` values. The result of the instruction is a vector
whose length is the same as the shuffle mask and whose element type is the
same as the element type of the first two operands.

Semantics:
""""""""""

The elements of the two input vectors are numbered from left to right
across both of the vectors. For each element of the result vector, the
shuffle mask selects an element from one of the input vectors to copy
to the result. Non-negative elements in the mask represent an index
into the concatenated pair of input vectors.

A ``poison`` element in the mask vector specifies that the resulting element is
``poison``. For backwards-compatibility reasons, LLVM temporarily also accepts
``undef`` mask elements. These will be interpreted the same way as ``poison``
mask elements, also producing a ``poison`` element in the result.

If the shuffle mask selects an ``undef`` element from one of the input
vectors, the resulting element is ``undef``.

For scalable vectors, the only valid mask values at present are
``zeroinitializer``, ``undef`` and ``poison``, since we cannot write all indices as
literals for a vector with a length unknown at compile time.

Example:
""""""""

.. code-block:: text

      <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2,
                              <4 x i32> <i32 0, i32 4, i32 1, i32 5>  ; yields <4 x i32>
      <result> = shufflevector <4 x i32> %v1, <4 x i32> poison,
                              <4 x i32> <i32 0, i32 1, i32 2, i32 3>  ; yields <4 x i32> - Identity shuffle.
      <result> = shufflevector <8 x i32> %v1, <8 x i32> poison,
                              <4 x i32> <i32 0, i32 1, i32 2, i32 3>  ; yields <4 x i32>
      <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2,
                              <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >  ; yields <8 x i32>

Aggregate Operations
--------------------

LLVM supports several instructions for working with
:ref:`aggregate <t_aggregate>` values.

TOOL CALL: langref

{"inst":"ashr"}

TOOL OUTPUT

.. _i_ashr:

'``ashr``' Instruction
^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

      <result> = ashr <ty> <op1>, <op2>         ; yields ty:result
      <result> = ashr exact <ty> <op1>, <op2>   ; yields ty:result

Overview:
"""""""""

The '``ashr``' instruction (arithmetic shift right) returns the first
operand shifted to the right a specified number of bits with sign
extension.

Arguments:
""""""""""

Both arguments to the '``ashr``' instruction must be the same
:ref:`integer <t_integer>` or :ref:`vector <t_vector>` of integer type.
'``op2``' is treated as an unsigned value.

Semantics:
""""""""""

This instruction always performs an arithmetic shift right operation,
The most significant bits of the result will be filled with the sign bit
of ``op1``. If ``op2`` is (statically or dynamically) equal to or larger
than the number of bits in ``op1``, this instruction returns a :ref:`poison
value <poisonvalues>`. If the arguments are vectors, each vector element
of ``op1`` is shifted by the corresponding shift amount in ``op2``.

If the ``exact`` keyword is present, the result value of the ``ashr`` is
a poison value if any of the bits shifted out are non-zero.

Example:
""""""""

.. code-block:: text

      <result> = ashr i32 4, 1   ; yields i32:result = 2
      <result> = ashr i32 4, 2   ; yields i32:result = 1
      <result> = ashr i8  4, 3   ; yields i8:result = 0
      <result> = ashr i8 -2, 1   ; yields i8:result = -1
      <result> = ashr i32 1, 32  ; undefined
      <result> = ashr <2 x i32> < i32 -2, i32 4>, < i32 1, i32 3>   ; yields: result=<2 x i32> < i32 -1, i32 0>

TOOL CALL: find250

{"directory":"llvm/test/Transforms/InstCombine","k":1,"pattern":"**/*bitcast*"}

TOOL OUTPUT

2012-07-30-addrsp-bitcast.ll
2012-6-7-vselect-bitcast.ll
2025-08-06-shufflevector-bitcast-vector-of-pointers.ll
AMDGPU/bitcast-fold-lane-ops.ll
bfloat-bitcast-fcmp-zero.ll
bitcast-bfloat-half-mixing.ll
bitcast-bigendian.ll
bitcast-bitcast.ll
bitcast-function.ll
bitcast-inselt-bitcast.ll
bitcast-inseltpoison.ll
bitcast-known-bits.ll
bitcast-phi-uselistorder.ll
bitcast-select-const-vector.ll
bitcast-sext-vector.ll
bitcast-store.ll
bitcast-vec-canon-inseltpoison.ll
bitcast-vec-canon.ll
bitcast.ll
compute-sign-bits-bitcast.ll
fp-ret-bitcast.ll
icmp-bitcast-glob.ll
insertelement-bitcast.ll
load-bitcast-select.ll
load-bitcast-vec.ll
load-bitcast32.ll
load-bitcast64.ll
multiple-uses-load-bitcast-select.ll
scalable-bitcast-inseltpoison.ll
scalable-bitcast.ll
shufflevec-bitcast-inseltpoison.ll
shufflevec-bitcast.ll
swifterror-argument-bitcast-fold.ll

TOOL CALL: grep250

{"args":"-nRI 'shufflevector.*poison\\|ashr <.*x i32>\\|ashr <.*x i16>' llvm/test/Transforms/InstCombine","k":1}

TOOL OUTPUT

llvm/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll:7:	%5 = ashr <4 x i16> %4, <i16 5, i16 5, i16 5, i16 5>		; <<4 x i16>> [#uses=1]
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:109:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:111:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:122:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:124:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:135:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:137:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:18:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:20:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:31:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:33:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:44:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:46:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:57:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:59:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:70:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:72:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:7:; CHECK-NEXT:    [[S:%.*]] = shufflevector <2 x float> [[I]], <2 x float> poison, <2 x i32> <i32 0, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:83:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:85:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:96:; CHECK-NEXT:    [[A:%.*]] = shufflevector <2 x i32> [[D1:%.*]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/demandelts.ll:98:; CHECK-NEXT:    [[S:%.*]] = shufflevector <4 x i16> [[I]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AArch64/neon-shift-intrinsics.ll:116:; CHECK-NEXT:    [[RESULT:%.*]] = ashr <8 x i16> [[A:%.*]], splat (i16 3)
llvm/test/Transforms/InstCombine/AArch64/neon-shift-intrinsics.ll:170:; CHECK-NEXT:    [[RESULT:%.*]] = ashr <8 x i16> [[A:%.*]], splat (i16 15)
llvm/test/Transforms/InstCombine/AArch64/neon-shift-intrinsics.ll:370:; CHECK-NEXT:    [[RESULT:%.*]] = ashr <2 x i32> [[A:%.*]], splat (i32 2)
llvm/test/Transforms/InstCombine/AArch64/neon-shift-intrinsics.ll:80:; CHECK-NEXT:    [[RESULT:%.*]] = ashr <4 x i32> [[A:%.*]], splat (i32 5)
llvm/test/Transforms/InstCombine/AArch64/neon-shift-intrinsics.ll:89:; CHECK-NEXT:    [[RESULT:%.*]] = ashr <4 x i32> [[A:%.*]], <i32 1, i32 2, i32 3, i32 4>
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:101:; CHECK-NEXT:    [[TMP6:%.*]] = shufflevector <vscale x 2 x i64> [[TMP5]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:122:; CHECK-NEXT:    [[TMP5:%.*]] = shufflevector <vscale x 4 x i32> [[TMP4]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:12:; CHECK-NEXT:    [[TMP5:%.*]] = shufflevector <vscale x 2 x i64> [[TMP4]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:205:; CHECK-NEXT:    [[TMP7:%.*]] = shufflevector <vscale x 2 x i64> [[TMP6]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:28:; CHECK-NEXT:    [[TMP2:%.*]] = shufflevector <8 x half> [[TMP1]], <8 x half> poison, <8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:52:; CHECK-NEXT:    [[TMP5:%.*]] = shufflevector <vscale x 4 x i32> [[TMP4]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-dupqlane.ll:77:; CHECK-NEXT:    [[TMP7:%.*]] = shufflevector <vscale x 2 x i64> [[TMP6]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:13:  %t1 = shufflevector <vscale x 16 x i8> %t0, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:29:; CHECK-NEXT:    [[T1:%.*]] = shufflevector <vscale x 4 x float> [[T0]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:33:  %t1 = shufflevector <vscale x 4 x float> %t0, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:49:; CHECK-NEXT:    [[T1:%.*]] = shufflevector <vscale x 16 x i8> [[T0]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:54:  %t1 = shufflevector <vscale x 16 x i8> %t0, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-insr.ll:9:; CHECK-NEXT:    [[T1:%.*]] = shufflevector <vscale x 16 x i8> [[T0]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-dup.ll:51:; CHECK-NEXT:    [[SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-dup.ll:61:; CHECK-NEXT:    [[INSERT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-dup.ll:79:; CHECK-NEXT:    [[INSERT:%.*]] = shufflevector <vscale x 4 x float> [[DOTSPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:153:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:163:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:176:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:189:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:202:  %splat = shufflevector <vscale x 4 x float> %splat_insert, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:215:  %splat = shufflevector <vscale x 4 x float> %splat_insert, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:228:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:241:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:254:  %splat = shufflevector <vscale x 4 x float> %splat_insert, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:267:  %splat = shufflevector <vscale x 4 x float> %splat_insert, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:279:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:281:  %splat2 = shufflevector <vscale x 16 x i8> %splat_insert2, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:291:; OPT-NEXT:    [[SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_INSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-lasta-lastb.ll:298:  %splat = shufflevector <vscale x 16 x i8> %splat_insert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:10:; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:14:  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:23:; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:27:  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:36:; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:40:  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:49:; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll:53:  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:13:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:26:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:39:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:52:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 2 x i64> [[DOTSPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:65:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 8 x half> [[DOTSPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:78:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 4 x float> [[DOTSPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-tbl-dupx.ll:91:; CHECK-NEXT:    [[OUT:%.*]] = shufflevector <vscale x 2 x double> [[DOTSPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:13:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:142:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:162:; CHECK-NEXT:    [[A:%.*]] = shufflevector <16 x i8> [[A1:%.*]], <16 x i8> poison, <16 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:201:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:23:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:247:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <16 x i32> <i32 0, i32 poison, i32 2, i32 poison, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:63:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:73:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> <i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
llvm/test/Transforms/InstCombine/AArch64/tbl.ll:83:; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <16 x i8> [[A:%.*]], <16 x i8> <i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1003:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1012:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1016:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1121:  %shuf = shufflevector <4 x half> %data, <4 x half> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:114:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1190:  %shuf = shufflevector <4 x i8> %data, <4 x i8> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:125:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1309:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1316:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1320:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1327:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1331:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1341:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1348:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1352:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1359:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1363:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:136:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1405:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1412:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1416:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:146:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1568:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1575:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1579:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:157:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1586:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1590:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1600:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1607:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1611:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1618:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1622:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:164:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1664:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1671:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1675:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:168:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1827:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1838:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1849:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1859:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1870:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1877:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1881:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1923:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:1934:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2040:  %shuf = shufflevector <4 x half> %data, <4 x half> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2109:  %shuf = shufflevector <4 x i8> %data, <4 x i8> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:210:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:221:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2228:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2239:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2250:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2260:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2271:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2278:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2282:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2324:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2335:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2441:  %shuf = shufflevector <4 x half> %data, <4 x half> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2510:  %shuf = shufflevector <4 x i8> %data, <4 x i8> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2629:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2636:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2640:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2647:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2651:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2661:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2668:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2672:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2679:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2683:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2725:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2732:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2736:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2880:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2887:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2891:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2898:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2902:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2912:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2919:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2923:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2930:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2934:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2976:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2983:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:2987:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3123:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3130:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3134:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3141:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3145:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3155:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3162:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3166:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3173:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3177:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3219:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3226:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3230:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:327:  %shuf = shufflevector <4 x half> %data, <4 x half> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3412:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3419:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3423:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3430:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3434:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3444:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3451:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3455:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3462:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3466:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3508:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3515:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3519:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3701:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3708:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3712:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3719:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3723:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3733:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3740:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3744:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3751:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3755:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3797:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3804:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3808:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3942:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3949:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3953:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3960:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3964:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:396:  %shuf = shufflevector <4 x i8> %data, <4 x i8> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3974:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3981:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3985:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3992:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:3996:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4038:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4045:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <3 x float> [[DATA]], <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4049:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4222:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4232:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4242:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4252:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4263:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4270:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <2 x float> [[DATA]], <2 x float> poison, <3 x i32> <i32 0, i32 1, i32 poison>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4274:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4281:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <2 x float> [[DATA]], <2 x float> poison, <3 x i32> <i32 0, i32 1, i32 poison>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4285:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4295:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4305:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4405:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4421:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4437:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4480:; CHECK-NEXT:    [[RES:%.*]] = shufflevector <3 x half> [[DATA]], <3 x half> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4484:  %res = shufflevector <4 x half> %data, <4 x half> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4491:; CHECK-NEXT:    [[RES:%.*]] = shufflevector <2 x half> [[DATA]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4495:  %res = shufflevector <4 x half> %data, <4 x half> poison, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:4506:  %res = shufflevector <4 x half> %data, <4 x half> poison, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:515:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 0, i32 1>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:526:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:537:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <2 x i32> <i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:547:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:558:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 1, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:565:; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x float> [[DATA]], <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:569:  %shuf = shufflevector <4 x float> %data, <4 x float> poison, <3 x i32> <i32 0, i32 2, i32 3>
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll:611:  %shuf = shufflevector <3 x float> %data, <3 x float> poison, <2 x i32> <i32 0, i32 1>

TOOL CALL: grep250

{"args":"-nRI 'm_CombineOr\\|struct m_Shuffle\\|m_Shuffle' llvm/include/llvm/IR/PatternMatch.h llvm/lib","k":1}

TOOL OUTPUT

llvm/include/llvm/IR/PatternMatch.h:1524:  return m_CombineOr(m_Add(L, R), m_DisjointOr(L, R));
llvm/include/llvm/IR/PatternMatch.h:1534:  return m_CombineOr(m_NSWAdd(L, R), m_DisjointOr(L, R));
llvm/include/llvm/IR/PatternMatch.h:1544:  return m_CombineOr(m_NUWAdd(L, R), m_DisjointOr(L, R));
llvm/include/llvm/IR/PatternMatch.h:2031:m_Shuffle(const V1_t &v1, const V2_t &v2) {
llvm/include/llvm/IR/PatternMatch.h:2037:m_Shuffle(const V1_t &v1, const V2_t &v2, const Mask_t &mask) {
llvm/include/llvm/IR/PatternMatch.h:207:  return m_CombineOr(m_Isa<ConstantExpr>(),
llvm/include/llvm/IR/PatternMatch.h:2195:  return m_CombineOr(m_PtrToInt(Op), m_PtrToAddr(Op));
llvm/include/llvm/IR/PatternMatch.h:2209:  return m_CombineOr(CastInst_match<OpTy, CastInst>(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2235:  return m_CombineOr(m_Trunc(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2258:  return m_CombineOr(m_ZExt(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2264:  return m_CombineOr(m_SExt(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2271:  return m_CombineOr(m_SExt(Op), m_NNegZExt(Op));
llvm/include/llvm/IR/PatternMatch.h:2278:  return m_CombineOr(m_ZExt(Op), m_SExt(Op));
llvm/include/llvm/IR/PatternMatch.h:2286:  return m_CombineOr(m_ZExtOrSExt(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2290:  return m_CombineOr(m_ZExt(Op), m_Trunc(Op), Op);
llvm/include/llvm/IR/PatternMatch.h:2384:  return m_CombineOr(m_UIToFP(Op), m_SIToFP(Op));
llvm/include/llvm/IR/PatternMatch.h:2401:  return m_CombineOr(m_FPToUI(Op), m_FPToSI(Op));
llvm/include/llvm/IR/PatternMatch.h:2602:  return m_CombineOr(FMaxMin_match<LHS, RHS, ofmax_pred_ty>(L, R),
llvm/include/llvm/IR/PatternMatch.h:2615:  return m_CombineOr(FMaxMin_match<LHS, RHS, ofmin_pred_ty>(L, R),
llvm/include/llvm/IR/PatternMatch.h:2803:/// This is more efficient than using nested m_CombineOr with m_Intrinsic
llvm/include/llvm/IR/PatternMatch.h:2932:  return m_CombineOr(m_SMax(Op0, Op1), m_SMin(Op0, Op1), m_UMax(Op0, Op1),
llvm/include/llvm/IR/PatternMatch.h:2976:  return m_CombineOr(m_FMaxNum(Op0, Op1), m_FMaximumNum(Op0, Op1));
llvm/include/llvm/IR/PatternMatch.h:2983:  return m_CombineOr(m_FMinNum(Op0, Op1), m_FMinimumNum(Op0, Op1));
llvm/include/llvm/IR/PatternMatch.h:3147:  return m_CombineOr(m_c_SMax(L, R), m_c_SMin(L, R), m_c_UMax(L, R),
llvm/include/llvm/IR/PatternMatch.h:3360:  return m_CombineOr(
llvm/include/llvm/IR/PatternMatch.h:516:inline auto m_AllOnesOrPoison() { return m_CombineOr(m_AllOnes(), m_Poison()); }
llvm/include/llvm/IR/PatternMatch.h:609:inline auto m_ZeroOrPoison() { return m_CombineOr(m_Zero(), m_Poison()); }
llvm/lib/Analysis/HashRecognize.cpp:179:  auto MatchPred = m_CombineOr(
llvm/lib/Analysis/IVDescriptors.cpp:934:  if (!match(I, m_CombineOr(m_Select(m_Cmp(), m_Value(), m_Specific(OrigPhi)),
llvm/lib/Analysis/InstructionSimplify.cpp:1866:  auto AbsOrSelfLHS0 = m_CombineOr(m_Specific(LHS0), m_FAbs(m_Specific(LHS0)));
llvm/lib/Analysis/InstructionSimplify.cpp:1881:  auto AbsOrSelfRHS0 = m_CombineOr(m_Specific(RHS0), m_FAbs(m_Specific(RHS0)));
llvm/lib/Analysis/InstructionSimplify.cpp:4871:    auto isFsh = m_CombineOr(m_FShl(m_Value(X), m_Value(), m_Value(ShAmt)),
llvm/lib/Analysis/InstructionSimplify.cpp:4884:        m_CombineOr(m_FShl(m_Value(X), m_Deferred(X), m_Value(ShAmt)),
llvm/lib/Analysis/LazyValueInfo.cpp:1415:  if (match(LHS, m_CombineOr(m_URem(m_Specific(Val), m_Value()),
llvm/lib/Analysis/OverflowInstAnalysis.cpp:41:        !match(II, m_CombineOr(m_Intrinsic<Intrinsic::umul_with_overflow>(),
llvm/lib/Analysis/ScalarEvolution.cpp:10929:  if (match(Step, m_CombineOr(m_scev_One(), m_scev_AllOnes()))) {
llvm/lib/Analysis/ValueTracking.cpp:10524:    if (match(I, m_CombineOr(m_PtrToIntOrAddr(m_Value(Op)),
llvm/lib/Analysis/ValueTracking.cpp:405:    return m_Instruction(SubBC, m_CombineOr(m_NUWSub(m_Value(B), m_Value(C)),
llvm/lib/Analysis/ValueTracking.cpp:414:    return m_CombineOr(m_c_Mul(m_Value(A), MatchSubBC()), MatchSubBC());
llvm/lib/Analysis/ValueTracking.cpp:422:    return m_CombineOr(m_c_Mul(m_Value(D), m_Specific(C)), m_Specific(C));
llvm/lib/Analysis/ValueTracking.cpp:850:    auto m_V = m_CombineOr(m_Specific(V), m_PtrToInt(m_Specific(V)));
llvm/lib/Analysis/ValueTracking.cpp:888:      m_CombineOr(m_Specific(V), m_PtrToIntSameSize(Q.DL, m_Specific(V)));
llvm/lib/Analysis/ValueTracking.cpp:9008:        m_CombineOr(m_Specific(CmpLHS), m_SExt(m_Specific(CmpLHS)));
llvm/lib/Analysis/ValueTracking.cpp:9009:    auto ZeroOrAllOnes = m_CombineOr(m_ZeroInt(), m_AllOnes());
llvm/lib/Analysis/ValueTracking.cpp:9010:    auto ZeroOrOne = m_CombineOr(m_ZeroInt(), m_One());
llvm/lib/Analysis/ValueTracking.cpp:940:    if (match(LHS, m_CombineOr(m_V, m_AddLike(m_V, m_APInt(Offset))))) {
llvm/lib/Analysis/VectorUtils.cpp:1268:  auto AllOneOrUndef = m_CombineOr(m_AllOnes(), m_UndefValue());
llvm/lib/Analysis/VectorUtils.cpp:1269:  return match(Mask, m_CombineOr(AllOneOrUndef, m_ContainsMatchingVectorElement(
llvm/lib/Analysis/VectorUtils.cpp:400:            m_Shuffle(m_InsertElt(m_Value(), m_Value(Splat), m_ZeroInt()),
llvm/lib/CodeGen/CodeGenPrepare.cpp:7919:  if (!match(SVI, m_Shuffle(m_InsertElt(m_Undef(), m_Value(), m_ZeroInt()),
llvm/lib/CodeGen/CodeGenPrepare.cpp:9348:          m_CombineOr(m_Cmp(), m_CombineOr(m_LogicalAnd(m_Value(), m_Value()),
llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:2000:  if (!match(RootI, m_Shuffle(m_Instruction(Real), m_Instruction(Imag))))
llvm/lib/CodeGen/InterleavedAccessPass.cpp:313:          all_of(BI->users(), match_fn(m_Shuffle(m_Value(), m_Undef())))) {
llvm/lib/CodeGen/InterleavedAccessPass.cpp:796:    if (match(&I, m_CombineOr(m_Load(m_Value()),
llvm/lib/CodeGen/InterleavedAccessPass.cpp:801:    if (match(&I, m_CombineOr(m_Store(m_Value(), m_Value()),
llvm/lib/IR/ConstantFold.cpp:697:      if (match(C2, m_CombineOr(m_Undef(), m_Zero())))
llvm/lib/IR/ConstantFold.cpp:705:      if (match(C2, m_CombineOr(m_Undef(), m_Zero())))llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:21527:                             m_Shuffle(m_InsertElt(m_Poison(),
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:6883:  if (!match(Op1, m_Shuffle(m_Value(S1Op1), m_Undef(), m_Mask(M1))) ||
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:6884:      !match(Op2, m_Shuffle(m_Value(S2Op1), m_Undef(), m_Mask(M2))))
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:7212:                m_Shuffle(m_InsertElt(m_Value(), m_Not(m_Value()), m_ZeroInt()),
llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp:2127:             m_CombineOr(m_FMinNum_or_FMinimumNum(m_Value(Arg0),
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp:3004:    if (!Shuffle || !match(Shuffle, m_Shuffle(m_InsertElt(m_Undef(), m_Value(),
llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp:1815:    return m_CombineOr(m_LShr(V, S), m_AShr(V, S));
llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp:156:  if (!match(Root, m_CombineOr(m_VPMerge, m_Freeze(m_VPMerge))))
llvm/lib/Target/RISCV/RISCVInterleavedAccess.cpp:110:  if (match(V, m_CombineOr(m_ConstantInt(C),
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:3578:        if (match(Op.get(), m_Shuffle(m_InsertElt(m_Value(), m_Not(m_Value()),
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:3613:    if (!match(Op, m_Shuffle(m_InsertElt(m_Value(), m_Value(), m_ZeroInt()),
llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp:538:  if (match(V, m_Shuffle(m_InsertElt(m_Value(), m_Value(), m_ZeroInt()),
llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp:2933:    if (match(Mask, m_OneUse(m_Shuffle(m_Value(MaskSrc), m_Undef(),
llvm/lib/Target/X86/X86TargetTransformInfo.cpp:7429:                m_Shuffle(m_InsertElt(m_Value(), m_Not(m_Value()), m_ZeroInt()),
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:1624:  if (match(Op0, m_CombineOr(m_NSWShl(m_Value(A), m_Value()),
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:1631:  if (match(Op1, m_CombineOr(m_NSWShl(m_Value(A), m_Value()),
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1059:              m_CombineOr(
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1542:                            m_CombineOr(m_Specific(X), m_Specific(XLo))),
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1544:                            m_CombineOr(m_Specific(Y), m_Specific(YLo))))))
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:3224:  if (match(OneUse, m_Shuffle(m_Value(X), m_Poison(), m_Mask(Mask))))
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2479:  if (match(&I, m_c_And(m_Value(Y), m_OneUse(m_CombineOr(
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3695:    if (!match(SrcVecI, m_Shuffle(m_Value(Vec), m_Constant(ConstVec),
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3805:  if (!match(ZExtOp0, m_CombineOr(m_OneUse(m_And(m_Value(MaskedOp0),
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3812:             m_CombineOr(m_OneUse(m_LShr(m_Value(Int), m_ConstantInt(LShrAmt))),
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1538:      !match(NonConstArg, m_Shuffle(m_Value(X), m_Poison(), m_Mask(Mask))))
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1543:  if (none_of(II->args(), match_fn(m_OneUse(m_Shuffle(m_Value(), m_Value())))))
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1554:                   m_Shuffle(m_Value(X), m_Poison(), m_SpecificMask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1711:      !match(Arg, m_Shuffle(m_Value(V), m_Undef(), m_Mask(Mask))) ||
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1004:  if (match(Shuf, m_OneUse(m_Shuffle(m_Value(ShufVec), m_Poison(),
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1159:            m_OneUse(m_CombineOr(
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:284:  if (match(Src, m_OneUse(m_Shuffle(m_Value(X), m_Poison(), m_Mask(Mask))))) {
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3336:             m_Shuffle(m_AShr(m_BitCast(m_Value(X)), m_Constant(ShiftVec)),
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:3337:                       m_CombineOr(m_Poison(), m_Undef()), m_Mask(Mask))))
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:706:  if (!match(TruncOp, m_CombineOr(m_BitCast(m_Value(VecInput)),
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3563:  if (match(BCSrcOp, m_Shuffle(m_Value(Vec), m_Undef(), m_Mask(Mask)))) {
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:6323:        m_CombineOr(m_CombineOr(m_c_Add(m_Value(B), m_Deferred(A)),
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:7407:                                  m_OneUse(m_CombineOr(
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:7464:  if (!match(LHS, m_Shuffle(m_Value(V1), m_Undef(), m_Mask(M))))
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:7471:  if (match(RHS, m_Shuffle(m_Value(V2), m_Undef(), m_SpecificMask(M))) &&
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1329:                     m_CombineOr(m_Zero(), m_UndefValue())))) {
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3113:  if (match(TVal, m_OneUse(m_Shuffle(m_Value(X), m_Value(Y), m_Mask(Mask)))) &&
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3127:  if (match(FVal, m_OneUse(m_Shuffle(m_Value(X), m_Value(Y), m_Mask(Mask)))) &&
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:5126:                                   m_CombineOr(m_Undef(), m_Zero()))) ||
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:5128:                                     m_CombineOr(m_Undef(), m_Zero()))))) {
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:5138:                                    m_CombineOr(m_Undef(), m_Zero()))) ||
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:5140:                                      m_CombineOr(m_Undef(), m_Zero())))) &&
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:233:  if (match(Masked, m_c_And(m_CombineOr(MaskA, MaskB), m_Value(X)))) {
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:270:  } else if (match(Masked, m_c_And(m_CombineOr(MaskC, MaskD), m_Value(X))) ||
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:74:        m_CombineOr(m_CombineAnd(m_Trunc(m_Instruction(Sh1)), m_Value(Trunc)),
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1989:          auto Shuf = m_Shuffle(m_Specific(ShufOp), m_Value(), m_Mask(Mask));
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2403:  else if (match(B0, m_CombineOr(m_BinOp(m_Value(X), m_Constant(C0)),
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2405:           match(B1, m_CombineOr(m_BinOp(m_Value(Y), m_Constant(C1)),
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2566:  if (!match(Cond, m_OneUse(m_Shuffle(m_Value(NarrowCond), m_Poison()))) ||
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2585:  if (!S0 || !match(S0, m_CombineOr(m_FNeg(m_Value(X)), m_FAbs(m_Value(X)))))
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2593:  if (!S1 || !match(S1, m_CombineOr(m_FNeg(m_Value(Y)), m_FAbs(m_Value(Y)))) ||
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2694:  if (!match(Op0, m_Shuffle(m_Value(X), m_Value(Y), m_Mask(Mask))))
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2893:  if (!match(Op0, m_BinOp(m_Shuffle(m_Value(X), m_Poison(), m_ZeroMask()),
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2896:                          m_Shuffle(m_Value(Y), m_Poison(), m_ZeroMask()))))
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:3345:          m_ZExt(m_CombineOr(
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:3347:              m_Instruction(SVI, m_Shuffle(m_Value(), m_Value()))))))
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:3355:    if (match(I, m_Shuffle(m_Value(V), m_Undef(), m_Mask(ShuffleMask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2496:  if (match(LHS, m_Shuffle(m_Value(L0), m_Value(L1), m_Mask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2497:      match(RHS, m_Shuffle(m_Value(R0), m_Value(R1), m_SpecificMask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2599:  if (match(LHS, m_Shuffle(m_Value(V1), m_Poison(), m_Mask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2600:      match(RHS, m_Shuffle(m_Value(V2), m_Poison(), m_SpecificMask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2610:      match(LHS, m_Shuffle(m_Value(V1), m_Value(V2), m_Mask(Mask))) &&
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2612:            m_Shuffle(m_Specific(V2), m_Specific(V1), m_SpecificMask(Mask)))) {
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2639:  if (match(&Inst, m_c_BinOp(m_OneUse(m_Shuffle(m_Value(V1), m_Poison(),
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2672:               m_OneUse(m_Shuffle(m_Value(X), m_Undef(), m_Mask(MaskC)))) ||
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3213:            m_OneUse(m_CombineOr(m_Mul(m_Value(), m_ConstantInt()),
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4116:                             m_CombineOr(m_Specific(Op),
llvm/lib/Transforms/Scalar/JumpThreading.cpp:2998:      bool IsAndOr = match(SI, m_CombineOr(m_LogicalAnd(), m_LogicalOr()));
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:131:  return m_CombineOr(m_Mul(L, R), m_FMul(L, R));
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:137:  return m_CombineOr(m_Add(L, R), m_FAdd(L, R));
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:1603:          Op, m_OneUse(m_CombineOr(
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:1605:                  m_CombineOr(m_Intrinsic<Intrinsic::matrix_transpose>(),
llvm/lib/Transforms/Scalar/Reassociate.cpp:971:                      m_OneUse(m_CombineOr(m_Add(m_Value(A), m_Value(B)),
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:3021:    if (match(Cond, m_CombineOr(m_LogicalAnd(), m_LogicalOr()))) {
llvm/lib/Transforms/Utils/Local.cpp:2696:            if (match(CI->getArgOperand(0), m_CombineOr(m_Zero(), m_Undef()))) {
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:3853:    if (match(V, m_CombineOr(
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:3854:                     m_CombineOr(
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7077:      if (match(U, m_CombineOr(m_ExtractLane(m_VPValue(), m_VPValue()),
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:27460:             match_fn(m_CombineOr(m_SMin(m_Value(), m_Value()),
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2778:                  m_ExtractElt(m_Value(EV2), m_CombineOr(m_ConstantInt(Ex2Idx),
llvm/lib/Transforms/Vectorize/VPlan.cpp:616:      match(R, m_CombineOr(m_BranchOnCond(), m_BranchOnCount()));
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:527:  return m_CombineOr(m_Trunc(Op0), Op0);
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:554:  return m_CombineOr(m_ZExt(Op0), m_SExt(Op0));
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:558:  return m_Isa<VPWidenCastRecipe>(m_CombineOr(m_ZExtOrSExt(Op0), m_FPExt(Op0)));
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:562:  return m_CombineOr(m_Sub(m_ZeroInt(), Op0), m_FNeg(Op0));
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:568:  return m_CombineOr(m_ZExt(Op0), Op0);
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:572:  return m_CombineOr(m_ZExt(Op0), m_Trunc(Op0), Op0);
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:788:  return m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:829:  return m_CombineOr(m_Select(Op0, Op1, Op2),
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:834:  return m_CombineOr(m_VPInstruction<VPInstruction::Not>(Op0),
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:840:  return m_CombineOr(m_Select(Op0, Op1, Op2), m_Select(m_Not(Op0), Op2, Op1));
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:845:  return m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:852:  return m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:859:  return m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:1225:                  m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:1242:                  m_CombineOr(m_Reverse(m_VPValue(ReverseOp)),
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1603:                 match_fn(m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:2337:                      m_CombineOr(m_CanIVInc, m_c_Add(m_CanIVInc, m_LiveIn())),
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:3223:               m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:3276:                match_fn(m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp:294:  if (match(&R, m_CombineOr(m_BranchOnCond(), m_BranchOnCount())))
llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp:680:                 m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp:770:        if (BVUser && match(BVUser, m_CombineOr(m_BuildVector(),
llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:67:      m_CombineOr(m_CanonicalIV(),
llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:74:      m_CombineOr(m_Isa<VPWidenCanonicalIVRecipe>(), m_CanonicalWidenIV());
llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:783:      if (match(U, m_CombineOr(m_Unary<Instruction::Load>(m_Specific(Cur)),
llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:89:  if (match(V, m_CombineOr(MaskMatch, m_Reverse(MaskMatch))))
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:156:                 m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:187:                  m_CombineOr(
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:374:            m_CombineOr(m_BranchOnCond(),
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:375:                        m_CombineOr(m_BranchOnCount(), m_BranchOnTwoConds()));
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:509:  if (!match(LastInst, m_CombineOr(m_BranchOnCond(),
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp:510:                                   m_CombineOr(m_BranchOnCount(),
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1088:                     m_Shuffle(m_Value(V0), m_Value(V1), m_Mask(Mask))))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2446:  if (!match(&I, m_Shuffle(m_BinOp(BinOp), m_Undef(), m_Mask(OuterMask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2456:                      m_Shuffle(m_Value(Op00), m_Value(Op01), m_Mask(Mask0)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2458:                      m_Shuffle(m_Value(Op10), m_Value(Op11), m_Mask(Mask1)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2571:  if (!match(&I, m_Shuffle(m_Instruction(LHS), m_Instruction(RHS),
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2654:    if (match(Op, m_OneUse(m_Shuffle(m_Value(InnerOp), m_Undef(),
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2740:  if (!match(&I, m_Shuffle(m_Select(m_Value(C1), m_Value(T1), m_Value(F1)),
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2822:  if (!match(&I, m_Shuffle(m_Value(V0), m_Value(V1), m_Mask(OldMask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2955:             m_Shuffle(m_Value(OuterV0), m_Value(OuterV1), m_Mask(OuterMask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2961:      match(OuterV0, m_Shuffle(m_Value(X0), m_Value(Y0), m_Mask(InnerMask0)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:2963:      match(OuterV1, m_Shuffle(m_Value(X1), m_Value(Y1), m_Mask(InnerMask1)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3121:    if (!match(Trunk, m_Shuffle(m_Value(OuterV0), m_Value(OuterV1),
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3133:        match(OuterV0, m_Shuffle(m_Value(A0), m_Value(B0), m_Mask(InnerMask0)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3135:        match(OuterV1, m_Shuffle(m_Value(A1), m_Value(B1), m_Mask(InnerMask1)));
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3286:  if (!match(&I, m_Shuffle(m_Value(V0), m_Value(V1), m_Mask(OldMask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3405:  if (!match(&I, m_Shuffle(m_Value(V0), m_Undef(), m_Mask(Mask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:6064:                 m_Shuffle(m_Specific(OldLoad), m_Undef(), m_Mask(Mask))))
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:6185:             m_OneUse(m_Shuffle(m_Value(Op), m_Poison(), m_Mask(Mask0)))) ||
llvm/lib/Transforms/Vectorize/VectorCombine.cpp:6187:             m_OneUse(m_Shuffle(m_Specific(Op), m_Poison(), m_Mask(Mask1)))))

TOOL CALL: read250

{"file":"llvm/include/llvm/IR/PatternMatch.h","position":1980}

TOOL OUTPUT

file: llvm/include/llvm/IR/PatternMatch.h:1980-2230
---------------------------------------------------
1980     return true;
1981   }
1982 };
1983 
1984 struct m_ZeroMask {
1985   bool match(ArrayRef<int> Mask) const {
1986     return all_of(Mask, [](int Elem) { return Elem == 0 || Elem == -1; });
1987   }
1988 };
1989 
1990 struct m_SpecificMask {
1991   ArrayRef<int> Val;
1992   m_SpecificMask(ArrayRef<int> Val) : Val(Val) {}
1993   bool match(ArrayRef<int> Mask) const { return Val == Mask; }
1994 };
1995 
1996 struct m_SplatMask {
1997   bool match(ArrayRef<int> Mask) const { return all_equal(Mask); }
1998 };
1999 
2000 struct m_SplatOrPoisonMask {
2001   int &SplatIndex;
2002   m_SplatOrPoisonMask(int &SplatIndex) : SplatIndex(SplatIndex) {}
2003   bool match(ArrayRef<int> Mask) const {
2004     const auto *First = find_if(Mask, [](int Elem) { return Elem != -1; });
2005     if (First == Mask.end())
2006       return false;
2007     SplatIndex = *First;
2008     return all_of(Mask,
2009                   [First](int Elem) { return Elem == *First || Elem == -1; });
2010   }
2011 };
2012 
2013 template <typename PointerOpTy, typename OffsetOpTy> struct PtrAdd_match {
2014   PointerOpTy PointerOp;
2015   OffsetOpTy OffsetOp;
2016 
2017   PtrAdd_match(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp)
2018       : PointerOp(PointerOp), OffsetOp(OffsetOp) {}
2019 
2020   template <typename OpTy> bool match(OpTy *V) const {
2021     auto *GEP = dyn_cast<GEPOperator>(V);
2022     return GEP && GEP->getSourceElementType()->isIntegerTy(8) &&
2023            PointerOp.match(GEP->getPointerOperand()) &&
2024            OffsetOp.match(GEP->idx_begin()->get());
2025   }
2026 };
2027 
2028 /// Matches ShuffleVectorInst independently of mask value.
2029 template <typename V1_t, typename V2_t>
2030 inline TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>
2031 m_Shuffle(const V1_t &v1, const V2_t &v2) {
2032   return TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>(v1, v2);
2033 }
2034 
2035 template <typename V1_t, typename V2_t, typename Mask_t>
2036 inline Shuffle_match<V1_t, V2_t, Mask_t>
2037 m_Shuffle(const V1_t &v1, const V2_t &v2, const Mask_t &mask) {
2038   return Shuffle_match<V1_t, V2_t, Mask_t>(v1, v2, mask);
2039 }
2040 
2041 /// Matches LoadInst.
2042 template <typename OpTy>
2043 inline OneOps_match<OpTy, Instruction::Load> m_Load(const OpTy &Op) {
2044   return OneOps_match<OpTy, Instruction::Load>(Op);
2045 }
2046 
2047 /// Matches StoreInst.
2048 template <typename ValueOpTy, typename PointerOpTy>
2049 inline TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>
2050 m_Store(const ValueOpTy &ValueOp, const PointerOpTy &PointerOp) {
2051   return TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>(ValueOp,
2052                                                                   PointerOp);
2053 }
2054 
2055 /// Matches GetElementPtrInst.
2056 template <typename... OperandTypes>
2057 inline auto m_GEP(const OperandTypes &...Ops) {
2058   return AnyOps_match<Instruction::GetElementPtr, OperandTypes...>(Ops...);
2059 }
2060 
2061 /// Matches GEP with i8 source element type
2062 template <typename PointerOpTy, typename OffsetOpTy>
2063 inline PtrAdd_match<PointerOpTy, OffsetOpTy>
2064 m_PtrAdd(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp) {
2065   return PtrAdd_match<PointerOpTy, OffsetOpTy>(PointerOp, OffsetOp);
2066 }
2067 
2068 //===----------------------------------------------------------------------===//
2069 // Matchers for CastInst classes
2070 //
2071 
2072 template <typename Op_t, unsigned Opcode> struct CastOperator_match {
2073   Op_t Op;
2074 
2075   CastOperator_match(const Op_t &OpMatch) : Op(OpMatch) {}
2076 
2077   template <typename OpTy> bool match(OpTy *V) const {
2078     if (auto *O = dyn_cast<Operator>(V))
2079       return O->getOpcode() == Opcode && Op.match(O->getOperand(0));
2080     return false;
2081   }
2082 };
2083 
2084 template <typename Op_t, typename Class> struct CastInst_match {
2085   Op_t Op;
2086 
2087   CastInst_match(const Op_t &OpMatch) : Op(OpMatch) {}
2088 
2089   template <typename OpTy> bool match(OpTy *V) const {
2090     if (auto *I = dyn_cast<Class>(V))
2091       return Op.match(I->getOperand(0));
2092     return false;
2093   }
2094 };
2095 
2096 template <typename Op_t> struct PtrToIntSameSize_match {
2097   const DataLayout &DL;
2098   Op_t Op;
2099 
2100   PtrToIntSameSize_match(const DataLayout &DL, const Op_t &OpMatch)
2101       : DL(DL), Op(OpMatch) {}
2102 
2103   template <typename OpTy> bool match(OpTy *V) const {
2104     if (auto *O = dyn_cast<Operator>(V))
2105       return O->getOpcode() == Instruction::PtrToInt &&
2106              DL.getTypeSizeInBits(O->getType()) ==
2107                  DL.getTypeSizeInBits(O->getOperand(0)->getType()) &&
2108              Op.match(O->getOperand(0));
2109     return false;
2110   }
2111 };
2112 
2113 template <typename Op_t> struct NNegZExt_match {
2114   Op_t Op;
2115 
2116   NNegZExt_match(const Op_t &OpMatch) : Op(OpMatch) {}
2117 
2118   template <typename OpTy> bool match(OpTy *V) const {
2119     if (auto *I = dyn_cast<ZExtInst>(V))
2120       return I->hasNonNeg() && Op.match(I->getOperand(0));
2121     return false;
2122   }
2123 };
2124 
2125 template <typename Op_t, unsigned WrapFlags = 0> struct NoWrapTrunc_match {
2126   Op_t Op;
2127 
2128   NoWrapTrunc_match(const Op_t &OpMatch) : Op(OpMatch) {}
2129 
2130   template <typename OpTy> bool match(OpTy *V) const {
2131     if (auto *I = dyn_cast<TruncInst>(V))
2132       return (I->getNoWrapKind() & WrapFlags) == WrapFlags &&
2133              Op.match(I->getOperand(0));
2134     return false;
2135   }
2136 };
2137 
2138 /// Matches BitCast.
2139 template <typename OpTy>
2140 inline CastOperator_match<OpTy, Instruction::BitCast>
2141 m_BitCast(const OpTy &Op) {
2142   return CastOperator_match<OpTy, Instruction::BitCast>(Op);
2143 }
2144 
2145 template <typename Op_t> struct ElementWiseBitCast_match {
2146   Op_t Op;
2147 
2148   ElementWiseBitCast_match(const Op_t &OpMatch) : Op(OpMatch) {}
2149 
2150   template <typename OpTy> bool match(OpTy *V) const {
2151     auto *I = dyn_cast<BitCastInst>(V);
2152     if (!I)
2153       return false;
2154     Type *SrcType = I->getSrcTy();
2155     Type *DstType = I->getType();
2156     // Make sure the bitcast doesn't change between scalar and vector and
2157     // doesn't change the number of vector elements.
2158     if (SrcType->isVectorTy() != DstType->isVectorTy())
2159       return false;
2160     if (VectorType *SrcVecTy = dyn_cast<VectorType>(SrcType);
2161         SrcVecTy && SrcVecTy->getElementCount() !=
2162                         cast<VectorType>(DstType)->getElementCount())
2163       return false;
2164     return Op.match(I->getOperand(0));
2165   }
2166 };
2167 
2168 template <typename OpTy>
2169 inline ElementWiseBitCast_match<OpTy> m_ElementWiseBitCast(const OpTy &Op) {
2170   return ElementWiseBitCast_match<OpTy>(Op);
2171 }
2172 
2173 /// Matches PtrToInt.
2174 template <typename OpTy>
2175 inline CastOperator_match<OpTy, Instruction::PtrToInt>
2176 m_PtrToInt(const OpTy &Op) {
2177   return CastOperator_match<OpTy, Instruction::PtrToInt>(Op);
2178 }
2179 
2180 template <typename OpTy>
2181 inline PtrToIntSameSize_match<OpTy> m_PtrToIntSameSize(const DataLayout &DL,
2182                                                        const OpTy &Op) {
2183   return PtrToIntSameSize_match<OpTy>(DL, Op);
2184 }
2185 
2186 /// Matches PtrToAddr.
2187 template <typename OpTy>
2188 inline CastOperator_match<OpTy, Instruction::PtrToAddr>
2189 m_PtrToAddr(const OpTy &Op) {
2190   return CastOperator_match<OpTy, Instruction::PtrToAddr>(Op);
2191 }
2192 
2193 /// Matches PtrToInt or PtrToAddr.
2194 template <typename OpTy> inline auto m_PtrToIntOrAddr(const OpTy &Op) {
2195   return m_CombineOr(m_PtrToInt(Op), m_PtrToAddr(Op));
2196 }
2197 
2198 /// Matches IntToPtr.
2199 template <typename OpTy>
2200 inline CastOperator_match<OpTy, Instruction::IntToPtr>
2201 m_IntToPtr(const OpTy &Op) {
2202   return CastOperator_match<OpTy, Instruction::IntToPtr>(Op);
2203 }
2204 
2205 /// Matches any cast or self. Used to ignore casts.
2206 template <typename OpTy>
2207 inline match_combine_or<CastInst_match<OpTy, CastInst>, OpTy>
2208 m_CastOrSelf(const OpTy &Op) {
2209   return m_CombineOr(CastInst_match<OpTy, CastInst>(Op), Op);
2210 }
2211 
2212 /// Matches Trunc.
2213 template <typename OpTy>
2214 inline CastInst_match<OpTy, TruncInst> m_Trunc(const OpTy &Op) {
2215   return CastInst_match<OpTy, TruncInst>(Op);
2216 }
2217 
2218 /// Matches trunc nuw.
2219 template <typename OpTy>
2220 inline NoWrapTrunc_match<OpTy, TruncInst::NoUnsignedWrap>
2221 m_NUWTrunc(const OpTy &Op) {
2222   return NoWrapTrunc_match<OpTy, TruncInst::NoUnsignedWrap>(Op);
2223 }
2224 
2225 /// Matches trunc nsw.
2226 template <typename OpTy>
2227 inline NoWrapTrunc_match<OpTy, TruncInst::NoSignedWrap>
2228 m_NSWTrunc(const OpTy &Op) {
2229   return NoWrapTrunc_match<OpTy, TruncInst::NoSignedWrap>(Op);
---------------------------------------------------

TOOL CALL: grep250

{"args":"-nRI 'struct Shuffle_match' llvm/include/llvm/IR/PatternMatch.h","k":1}

TOOL OUTPUT

1958:template <typename T0, typename T1, typename T2> struct Shuffle_match {

TOOL CALL: read250

{"file":"llvm/include/llvm/IR/PatternMatch.h","position":1938}

TOOL OUTPUT

file: llvm/include/llvm/IR/PatternMatch.h:1938-2188
---------------------------------------------------
1938 inline OneOps_match<OpTy, Instruction::Freeze> m_Freeze(const OpTy &Op) {
1939   return OneOps_match<OpTy, Instruction::Freeze>(Op);
1940 }
1941 
1942 /// Matches InsertElementInst.
1943 template <typename Val_t, typename Elt_t, typename Idx_t>
1944 inline ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>
1945 m_InsertElt(const Val_t &Val, const Elt_t &Elt, const Idx_t &Idx) {
1946   return ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>(
1947       Val, Elt, Idx);
1948 }
1949 
1950 /// Matches ExtractElementInst.
1951 template <typename Val_t, typename Idx_t>
1952 inline TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>
1953 m_ExtractElt(const Val_t &Val, const Idx_t &Idx) {
1954   return TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>(Val, Idx);
1955 }
1956 
1957 /// Matches shuffle.
1958 template <typename T0, typename T1, typename T2> struct Shuffle_match {
1959   T0 Op1;
1960   T1 Op2;
1961   T2 Mask;
1962 
1963   Shuffle_match(const T0 &Op1, const T1 &Op2, const T2 &Mask)
1964       : Op1(Op1), Op2(Op2), Mask(Mask) {}
1965 
1966   template <typename OpTy> bool match(OpTy *V) const {
1967     if (auto *I = dyn_cast<ShuffleVectorInst>(V)) {
1968       return Op1.match(I->getOperand(0)) && Op2.match(I->getOperand(1)) &&
1969              Mask.match(I->getShuffleMask());
1970     }
1971     return false;
1972   }
1973 };
1974 
1975 struct m_Mask {
1976   ArrayRef<int> &MaskRef;
1977   m_Mask(ArrayRef<int> &MaskRef) : MaskRef(MaskRef) {}
1978   bool match(ArrayRef<int> Mask) const {
1979     MaskRef = Mask;
1980     return true;
1981   }
1982 };
1983 
1984 struct m_ZeroMask {
1985   bool match(ArrayRef<int> Mask) const {
1986     return all_of(Mask, [](int Elem) { return Elem == 0 || Elem == -1; });
1987   }
1988 };
1989 
1990 struct m_SpecificMask {
1991   ArrayRef<int> Val;
1992   m_SpecificMask(ArrayRef<int> Val) : Val(Val) {}
1993   bool match(ArrayRef<int> Mask) const { return Val == Mask; }
1994 };
1995 
1996 struct m_SplatMask {
1997   bool match(ArrayRef<int> Mask) const { return all_equal(Mask); }
1998 };
1999 
2000 struct m_SplatOrPoisonMask {
2001   int &SplatIndex;
2002   m_SplatOrPoisonMask(int &SplatIndex) : SplatIndex(SplatIndex) {}
2003   bool match(ArrayRef<int> Mask) const {
2004     const auto *First = find_if(Mask, [](int Elem) { return Elem != -1; });
2005     if (First == Mask.end())
2006       return false;
2007     SplatIndex = *First;
2008     return all_of(Mask,
2009                   [First](int Elem) { return Elem == *First || Elem == -1; });
2010   }
2011 };
2012 
2013 template <typename PointerOpTy, typename OffsetOpTy> struct PtrAdd_match {
2014   PointerOpTy PointerOp;
2015   OffsetOpTy OffsetOp;
2016 
2017   PtrAdd_match(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp)
2018       : PointerOp(PointerOp), OffsetOp(OffsetOp) {}
2019 
2020   template <typename OpTy> bool match(OpTy *V) const {
2021     auto *GEP = dyn_cast<GEPOperator>(V);
2022     return GEP && GEP->getSourceElementType()->isIntegerTy(8) &&
2023            PointerOp.match(GEP->getPointerOperand()) &&
2024            OffsetOp.match(GEP->idx_begin()->get());
2025   }
2026 };
2027 
2028 /// Matches ShuffleVectorInst independently of mask value.
2029 template <typename V1_t, typename V2_t>
2030 inline TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>
2031 m_Shuffle(const V1_t &v1, const V2_t &v2) {
2032   return TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>(v1, v2);
2033 }
2034 
2035 template <typename V1_t, typename V2_t, typename Mask_t>
2036 inline Shuffle_match<V1_t, V2_t, Mask_t>
2037 m_Shuffle(const V1_t &v1, const V2_t &v2, const Mask_t &mask) {
2038   return Shuffle_match<V1_t, V2_t, Mask_t>(v1, v2, mask);
2039 }
2040 
2041 /// Matches LoadInst.
2042 template <typename OpTy>
2043 inline OneOps_match<OpTy, Instruction::Load> m_Load(const OpTy &Op) {
2044   return OneOps_match<OpTy, Instruction::Load>(Op);
2045 }
2046 
2047 /// Matches StoreInst.
2048 template <typename ValueOpTy, typename PointerOpTy>
2049 inline TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>
2050 m_Store(const ValueOpTy &ValueOp, const PointerOpTy &PointerOp) {
2051   return TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>(ValueOp,
2052                                                                   PointerOp);
2053 }
2054 
2055 /// Matches GetElementPtrInst.
2056 template <typename... OperandTypes>
2057 inline auto m_GEP(const OperandTypes &...Ops) {
2058   return AnyOps_match<Instruction::GetElementPtr, OperandTypes...>(Ops...);
2059 }
2060 
2061 /// Matches GEP with i8 source element type
2062 template <typename PointerOpTy, typename OffsetOpTy>
2063 inline PtrAdd_match<PointerOpTy, OffsetOpTy>
2064 m_PtrAdd(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp) {
2065   return PtrAdd_match<PointerOpTy, OffsetOpTy>(PointerOp, OffsetOp);
2066 }
2067 
2068 //===----------------------------------------------------------------------===//
2069 // Matchers for CastInst classes
2070 //
2071 
2072 template <typename Op_t, unsigned Opcode> struct CastOperator_match {
2073   Op_t Op;
2074 
2075   CastOperator_match(const Op_t &OpMatch) : Op(OpMatch) {}
2076 
2077   template <typename OpTy> bool match(OpTy *V) const {
2078     if (auto *O = dyn_cast<Operator>(V))
2079       return O->getOpcode() == Opcode && Op.match(O->getOperand(0));
2080     return false;
2081   }
2082 };
2083 
2084 template <typename Op_t, typename Class> struct CastInst_match {
2085   Op_t Op;
2086 
2087   CastInst_match(const Op_t &OpMatch) : Op(OpMatch) {}
2088 
2089   template <typename OpTy> bool match(OpTy *V) const {
2090     if (auto *I = dyn_cast<Class>(V))
2091       return Op.match(I->getOperand(0));
2092     return false;
2093   }
2094 };
2095 
2096 template <typename Op_t> struct PtrToIntSameSize_match {
2097   const DataLayout &DL;
2098   Op_t Op;
2099 
2100   PtrToIntSameSize_match(const DataLayout &DL, const Op_t &OpMatch)
2101       : DL(DL), Op(OpMatch) {}
2102 
2103   template <typename OpTy> bool match(OpTy *V) const {
2104     if (auto *O = dyn_cast<Operator>(V))
2105       return O->getOpcode() == Instruction::PtrToInt &&
2106              DL.getTypeSizeInBits(O->getType()) ==
2107                  DL.getTypeSizeInBits(O->getOperand(0)->getType()) &&
2108              Op.match(O->getOperand(0));
2109     return false;
2110   }
2111 };
2112 
2113 template <typename Op_t> struct NNegZExt_match {
2114   Op_t Op;
2115 
2116   NNegZExt_match(const Op_t &OpMatch) : Op(OpMatch) {}
2117 
2118   template <typename OpTy> bool match(OpTy *V) const {
2119     if (auto *I = dyn_cast<ZExtInst>(V))
2120       return I->hasNonNeg() && Op.match(I->getOperand(0));
2121     return false;
2122   }
2123 };
2124 
2125 template <typename Op_t, unsigned WrapFlags = 0> struct NoWrapTrunc_match {
2126   Op_t Op;
2127 
2128   NoWrapTrunc_match(const Op_t &OpMatch) : Op(OpMatch) {}
2129 
2130   template <typename OpTy> bool match(OpTy *V) const {
2131     if (auto *I = dyn_cast<TruncInst>(V))
2132       return (I->getNoWrapKind() & WrapFlags) == WrapFlags &&
2133              Op.match(I->getOperand(0));
2134     return false;
2135   }
2136 };
2137 
2138 /// Matches BitCast.
2139 template <typename OpTy>
2140 inline CastOperator_match<OpTy, Instruction::BitCast>
2141 m_BitCast(const OpTy &Op) {
2142   return CastOperator_match<OpTy, Instruction::BitCast>(Op);
2143 }
2144 
2145 template <typename Op_t> struct ElementWiseBitCast_match {
2146   Op_t Op;
2147 
2148   ElementWiseBitCast_match(const Op_t &OpMatch) : Op(OpMatch) {}
2149 
2150   template <typename OpTy> bool match(OpTy *V) const {
2151     auto *I = dyn_cast<BitCastInst>(V);
2152     if (!I)
2153       return false;
2154     Type *SrcType = I->getSrcTy();
2155     Type *DstType = I->getType();
2156     // Make sure the bitcast doesn't change between scalar and vector and
2157     // doesn't change the number of vector elements.
2158     if (SrcType->isVectorTy() != DstType->isVectorTy())
2159       return false;
2160     if (VectorType *SrcVecTy = dyn_cast<VectorType>(SrcType);
2161         SrcVecTy && SrcVecTy->getElementCount() !=
2162                         cast<VectorType>(DstType)->getElementCount())
2163       return false;
2164     return Op.match(I->getOperand(0));
2165   }
2166 };
2167 
2168 template <typename OpTy>
2169 inline ElementWiseBitCast_match<OpTy> m_ElementWiseBitCast(const OpTy &Op) {
2170   return ElementWiseBitCast_match<OpTy>(Op);
2171 }
2172 
2173 /// Matches PtrToInt.
2174 template <typename OpTy>
2175 inline CastOperator_match<OpTy, Instruction::PtrToInt>
2176 m_PtrToInt(const OpTy &Op) {
2177   return CastOperator_match<OpTy, Instruction::PtrToInt>(Op);
2178 }
2179 
2180 template <typename OpTy>
2181 inline PtrToIntSameSize_match<OpTy> m_PtrToIntSameSize(const DataLayout &DL,
2182                                                        const OpTy &Op) {
2183   return PtrToIntSameSize_match<OpTy>(DL, Op);
2184 }
2185 
2186 /// Matches PtrToAddr.
2187 template <typename OpTy>
---------------------------------------------------

TOOL CALL: langref

{"inst":"bitcast"}

TOOL OUTPUT

.. _i_bitcast:

'``bitcast .. to``' Instruction
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

      <result> = bitcast <ty> <value> to <ty2>             ; yields ty2

Overview:
"""""""""

The '``bitcast``' instruction converts ``value`` to type ``ty2`` without
changing any bits.

Arguments:
""""""""""

The '``bitcast``' instruction takes a value to cast, which must be a
non-aggregate first class value, and a type to cast it to, which must
also be a non-aggregate :ref:`first class <t_firstclass>` type. The
bit sizes of ``value`` and the destination type, ``ty2``, must be
identical. If the source type is a pointer, the destination type must also be a
pointer or a byte (vector of bytes) of the same size. This instruction supports
bitwise conversion of vectors to integers and to vectors of other types (as long
as they have the same size).

Semantics:
""""""""""

The '``bitcast``' instruction converts ``value`` to type ``ty2``. It
is always a *no-op cast* because no bits change with this
conversion. The conversion is done as if the ``value`` had been stored
to memory and read back as type ``ty2``. Pointer (or vector of
pointers) types may only be converted to other pointer (or vector of
pointers) types with the same address space or byte (or vector of bytes) types
through this instruction. To convert pointers to other types, use the
:ref:`inttoptr <i_inttoptr>` or :ref:`ptrtoint <i_ptrtoint>` instructions first.

There is a caveat for bitcasts involving vector types in relation to
endianness. For example ``bitcast <2 x i8> <value> to i16`` puts element zero
of the vector in the least significant bits of the i16 for little-endian while
element zero ends up in the most significant bits for big-endian.

If ``value`` is of the :ref:`byte type <t_byte>`:

* If ``ty2`` is a scalar type:

    * If ``ty2`` is a byte type, the original bits are unchanged.

    * If ``ty2`` is a pointer type:

        * If at least one bit of ``value`` is ``poison``, the result is
          ``poison``.

        * If all bits of ``value`` are from the same pointer and are correctly
          ordered (there were no pointer bit swaps), the result is that pointer.

        * Otherwise, the result is a pointer with the address given by the
          integer value of the input, and without provenance.

    * If ``ty2`` is an integer or floating-point type:

        * If at least one bit of ``value`` is ``poison``, the result is
          ``poison``.

        * Otherwise, the result is the value encoded by the input bits with
          their provenance stripped without being exposed.

* If ``ty2`` is a vector type, the input bits get sliced into chunks
  corresponding to lanes of the output. Each lane is then converted using the
  rules for scalar types above.

Example:
""""""""

.. code-block:: text

      %X = bitcast i8 255 to i8         ; yields i8 :-1
      %Y = bitcast i32* %x to i16*      ; yields i16*:%x
      %Z = bitcast <2 x i32> %V to i64; ; yields i64: %V (depends on endianness)
      %Z = bitcast <2 x i32*> %V to <2 x i64*> ; yields <2 x i64*>

      ; considering %bi to hold an integer and %bp to hold a pointer,
      %a = bitcast b64 %bi to i64       ; returns an integer, no-op cast
      %b = bitcast b64 %bp to i64       ; reinterprets the pointer as an integer, returning its address without exposing provenance
      %c = bitcast b64 %bp to ptr       ; returns a pointer, no-op cast
      %d = bitcast b64 %bi to ptr       ; reinterprets the integer as a pointer, returning a pointer with no provenance

      %e = bitcast <2 x b32> %v to i64  ; reinterprets the raw bytes as an integer
      %f = bitcast <2 x b32> %v to ptr  ; reinterprets the raw bytes as a pointer

      %g = bitcast <2 x b32> %v to <4 x i16> ; reinterprets the raw bytes as integers

TOOL CALL: stop

{"strategies":[{"expected_issue":"On a big-endian datalayout, InstCombine may fold to `ashr <1 x i64> %x, <i64 63>` and change the result from all-ones to zero for inputs such as `0x0000000080000000`.","name":"Big-endian v1i64 low-half sign-bit false positive","rationale":"The fold assumes that after `bitcast <1 x i64> -> <2 x i32>`, element 1 is the high 32-bit half. That is true on little-endian, but on big-endian element 1 is the low half. If the low half has bit 31 set while the i64 sign bit is clear, the original pattern computes all-ones but the wide `ashr` computes zero.","target":"Mutate the canonical v1i64/i32 pattern by adding a big-endian datalayout and a constant or testable input with high 32 bits zero and low 32-bit sign bit set; expect no fold or correct endian-adjusted fold."},{"expected_issue":"On big-endian targets, InstCombine may change a negative i64 result from zero to all-ones, e.g. for `0x8000000000000000`.","name":"Big-endian v1i64 high-sign lost through low-half selection","rationale":"For big-endian vector bitcasts, mask `<1,1>` duplicates the low 32-bit half, not the high 32-bit half. If the i64 sign bit is set but the low half sign bit is clear, the original pattern produces zero while the replacement `ashr i64, 63` produces all-ones.","target":"Use the same fold shape with big-endian datalayout and input/constant whose high half is negative and low half is non-negative; check that the fold is not applied."},{"expected_issue":"The fold may incorrectly replace a per-lane big-endian computation with a wide per-lane sign splat, causing mixed lanes to be wrong independently.","name":"Big-endian multi-lane v2i64 lane-wise mismatch","rationale":"The loop checks masks per wide element but does not consult datalayout. With `<2 x i64> -> <4 x i32>`, each pair `<2k,2k+1>` has the same endian inversion problem. A mixed vector such as lane0 low-half sign set/high sign clear and lane1 high sign set/low sign clear exposes both directions simultaneously.","target":"Mutate the canonical test from `<1 x i64>` to `<2 x i64>` with mask `<1,1,3,3>`, shifts `<0,31,0,31>`, and big-endian datalayout; use constants or FileCheck to ensure no wide `ashr <2 x i64>, splat(63)` appears."},{"expected_issue":"The generalized fold may be wrong for big-endian non-i64 widths, e.g. `i32` widened from two `i16` halves, returning sign of the wrong half.","name":"Big-endian generalized width mismatch vNi32/i16","rationale":"The implementation is generic for any even integer width `W >= 4`, not only the stated X86 `i64` emulation. The same high-half assumption fails for `bitcast <N x i32> -> <2N x i16>` on big-endian systems; mask `<1,1>` duplicates the low 16 bits rather than the sign-containing high 16 bits.","target":"Create a big-endian `<1 x i32>` or `<2 x i32>` variant with inner `ashr <2 x i16>/<4 x i16>` shifts `<0,15,...>` and mask `<1,1,...>`; check that InstCombine does not form `ashr <N x i32>, splat(31)`."},{"expected_issue":"If the inner narrow `ashr` is marked `exact`, the fold may remove the `exact` poison condition and make formerly poison cases defined. This is likely a legal refinement, but it should be explicitly tested to avoid accidental expectations about preserving exactness or later transforms relying on it.","name":"Inner exact ashr poison relaxation regression guard","rationale":"`m_AShr` matches an `ashr` regardless of the `exact` flag, and the replacement creates a non-exact wide `ashr`. For inputs where the selected high half has shifted-out one bits, the original `ashr exact` lane is poison while the replacement is defined. Although making poison more defined is generally allowed, this is a notable semantic relaxation and should be covered so reviewers consciously accept it.","target":"Mutate the canonical little-endian pattern by adding `exact` to the narrow `ashr` and using a high half with low bits set; verify the intended behavior/check line is stable and no invalid `exact` flag is propagated to the new wide `ashr`."}],"thoughts":"### 1. Fix Understanding\n\nThe patch adds `foldBitcastShuffleAShrToWideAShr()` to `InstCombineCasts.cpp` and invokes it from `visitBitCast()`. It recognizes a vector bitcast/shuffle/arithmetic-shift idiom:\n\n```\n%bc1 = bitcast <N x iW> %x to <2N x i(W/2)>\n%shr = ashr <2N x i(W/2)> %bc1, <0, W/2-1, 0, W/2-1, ...>\n%shuf = shufflevector %shr, poison/undef, <1,1,3,3,...>\n%bc2 = bitcast <2N x i(W/2)> %shuf to <N x iW>\n```\n\nand replaces the outer bitcast with:\n\n```\n%wide = ashr <N x iW> %x, splat(W-1)\n```\n\nThe intended effect is recognizing the pre-AVX512 X86 pattern for sign-splatting each i64 lane by duplicating the shifted high i32 half.\n\nThe main implementation segments are:\n\n* Type filter: outer result and source must be fixed vectors of integer elements; source element count must be twice destination element count; source element width must be `W/2`; `W >= 4`.\n* Pattern match: outer bitcast operand must be a `shufflevector` whose first operand is `ashr (bitcast X), constant_shift_vector`, whose second operand is whole-vector poison or undef, and whose mask is captured.\n* Type equality: `X->getType() == DstTy`.\n* Per-pair validation: shift amount for low half is zero; shift amount for high half is `Half - 1`; shuffle duplicates index `2*i+1` into both half positions.\n* Replacement: build a constant vector splat of `W - 1` and create a wide `ashr`.\n\nNearby code shows this is a normal InstCombine fold with no target hook or DataLayout endianness check. LangRef confirms that `bitcast` involving vectors is endian-sensitive: element zero maps to least-significant bits on little-endian and most-significant bits on big-endian. LangRef also confirms `ashr` by an amount greater than or equal to element width is poison; here both old and new shift amounts are in range for valid even `W`.\n\n### 2. Formal Semantic Modeling\n\nFor each wide lane `x_i` of width `W`, let `Half = W/2`.\n\nUnder little-endian vector bitcast semantics:\n\n* `bitcast x_i to <2 x iHalf>` gives approximately `[lo_i, hi_i]`.\n* `ashr` by `[0, Half-1]` gives `[lo_i, sign_splat(hi_i)]`.\n* shuffle mask `[1,1]` gives `[sign_splat(hi_i), sign_splat(hi_i)]`.\n* bitcast back to `iW` gives all bits equal to the sign bit of `x_i`, which equals `ashr x_i, W-1`.\n\nSo on little-endian the claimed contract is:\n\n```\nbitcast(shuffle(ashr(bitcast(x), pattern_shifts), poison, pattern_mask))\n  == ashr x, W-1\n```\n\nOn big-endian, however:\n\n* `bitcast x_i to <2 x iHalf>` gives `[hi_i, lo_i]`.\n* The same shift vector `[0, Half-1]` shifts `lo_i`, not `hi_i`, by `Half-1`.\n* The same mask `[1,1]` duplicates the sign of `lo_i`.\n* The replacement uses the sign of the full `iW`, i.e. sign of `hi_i`.\n\nThus the fold is not endian-neutral.\n\nConcrete big-endian instantiation for `W=64, Half=32, N=1`:\n\n* `x = 0x0000000080000000`.\n* Original: `bitcast <1 x i64> x -> <2 x i32> [0x00000000, 0x80000000]`; shifts `[0,31]` produce `[0, -1]`; shuffle `<1,1>` gives `[-1,-1]`; bitcast back gives `0xffffffffffffffff`.\n* Replacement: `ashr i64 0x0000000080000000, 63` gives `0`.\n\nOpposite concrete mismatch:\n\n* `x = 0x8000000000000000`.\n* Original big-endian pattern duplicates low half `0x00000000`, producing `0`.\n* Replacement wide `ashr` sees the i64 sign bit set and produces `0xffffffffffffffff`.\n\n### 3. Assumptions and Preconditions Identified\n\nThe correctness of the fold relies on these preconditions:\n\n1. The selected narrow lane `2*i+1` must contain the sign-containing high half of wide lane `i`.\n2. The final bitcast of two duplicated narrow sign-splat halves must reconstruct the all-zero/all-one wide sign-splat value.\n3. The vector bitcast lane order must match the assumed low-half/high-half order.\n4. The source and destination vector bit widths must make the bitcasts legal and `W` must effectively be even.\n5. The inner `ashr` shift constants must be exactly in range and exactly match the low/high half pattern.\n6. Poison/undef behavior of unused halves must not become more restrictive in the replacement.\n7. If the inner `ashr` has flags such as `exact`, dropping them must be an accepted refinement.\n\nThe patch explicitly checks most structural preconditions, but it does not check the DataLayout endianness. Because LLVM vector bitcasts are endian-sensitive, the lane-numbering precondition is false on big-endian targets for the mask/shift pattern being matched.\n\n### 4. Potential Cases to Break Assumptions\n\n* Big-endian datalayout with `mask[2k] = mask[2k+1] = 2k+1`: lane `2k+1` is the low half, not the high half. The replacement reads the full wide sign bit, while the original reads the sign bit of the low half.\n* Big-endian values where the low-half sign bit differs from the full wide sign bit: these produce observable mismatches in both directions.\n* Multi-lane vectors on big-endian datalayout: the same mismatch applies independently to each pair, so mixed lanes can expose lane-wise wrong-code.\n* Non-i64 widths on big-endian datalayout: the implementation is generalized beyond the X86 i64 idiom, so `<N x i32>/<2N x i16>` and similar widths inherit the same endian bug.\n* Inner `ashr exact`: not likely a wrong-code bug because removing poison is usually a refinement, but it is a subtle semantic relaxation worth guarding so future changes do not accidentally propagate `exact` to the wide shift.\n\n### 5. Test Strategies\n\nThe proposed strategies focus primarily on the missing endian precondition, because that is the strongest semantic gap in the patch. Big-endian tests should use an explicit datalayout such as a big-endian target layout and should FileCheck that the old pattern remains or at least that the wide `ashr <N x iW>, splat(W-1)` is not produced for the little-endian-specific mask. A separate positive little-endian test can still check the intended fold."}

TOOL OUTPUT

{
  "strategies": [
    [
      "Big-endian v1i64 low-half sign-bit false positive",
      "Mutate the canonical v1i64/i32 pattern by adding a big-endian datalayout and a constant or testable input with high 32 bits zero and low 32-bit sign bit set; expect no fold or correct endian-adjusted fold.",
      "The fold assumes that after `bitcast <1 x i64> -> <2 x i32>`, element 1 is the high 32-bit half. That is true on little-endian, but on big-endian element 1 is the low half. If the low half has bit 31 set while the i64 sign bit is clear, the original pattern computes all-ones but the wide `ashr` computes zero.",
      "On a big-endian datalayout, InstCombine may fold to `ashr <1 x i64> %x, <i64 63>` and change the result from all-ones to zero for inputs such as `0x0000000080000000`."
    ],
    [
      "Big-endian v1i64 high-sign lost through low-half selection",
      "Use the same fold shape with big-endian datalayout and input/constant whose high half is negative and low half is non-negative; check that the fold is not applied.",
      "For big-endian vector bitcasts, mask `<1,1>` duplicates the low 32-bit half, not the high 32-bit half. If the i64 sign bit is set but the low half sign bit is clear, the original pattern produces zero while the replacement `ashr i64, 63` produces all-ones.",
      "On big-endian targets, InstCombine may change a negative i64 result from zero to all-ones, e.g. for `0x8000000000000000`."
    ],
    [
      "Big-endian multi-lane v2i64 lane-wise mismatch",
      "Mutate the canonical test from `<1 x i64>` to `<2 x i64>` with mask `<1,1,3,3>`, shifts `<0,31,0,31>`, and big-endian datalayout; use constants or FileCheck to ensure no wide `ashr <2 x i64>, splat(63)` appears.",
      "The loop checks masks per wide element but does not consult datalayout. With `<2 x i64> -> <4 x i32>`, each pair `<2k,2k+1>` has the same endian inversion problem. A mixed vector such as lane0 low-half sign set/high sign clear and lane1 high sign set/low sign clear exposes both directions simultaneously.",
      "The fold may incorrectly replace a per-lane big-endian computation with a wide per-lane sign splat, causing mixed lanes to be wrong independently."
    ],
    [
      "Big-endian generalized width mismatch vNi32/i16",
      "Create a big-endian `<1 x i32>` or `<2 x i32>` variant with inner `ashr <2 x i16>/<4 x i16>` shifts `<0,15,...>` and mask `<1,1,...>`; check that InstCombine does not form `ashr <N x i32>, splat(31)`.",
      "The implementation is generic for any even integer width `W >= 4`, not only the stated X86 `i64` emulation. The same high-half assumption fails for `bitcast <N x i32> -> <2N x i16>` on big-endian systems; mask `<1,1>` duplicates the low 16 bits rather than the sign-containing high 16 bits.",
      "The generalized fold may be wrong for big-endian non-i64 widths, e.g. `i32` widened from two `i16` halves, returning sign of the wrong half."
    ],
    [
      "Inner exact ashr poison relaxation regression guard",
      "Mutate the canonical little-endian pattern by adding `exact` to the narrow `ashr` and using a high half with low bits set; verify the intended behavior/check line is stable and no invalid `exact` flag is propagated to the new wide `ashr`.",
      "`m_AShr` matches an `ashr` regardless of the `exact` flag, and the replacement creates a non-exact wide `ashr`. For inputs where the selected high half has shifted-out one bits, the original `ashr exact` lane is poison while the replacement is defined. Although making poison more defined is generally allowed, this is a notable semantic relaxation and should be covered so reviewers consciously accept it.",
      "If the inner narrow `ashr` is marked `exact`, the fold may remove the `exact` poison condition and make formerly poison cases defined. This is likely a legal refinement, but it should be explicitly tested to avoid accidental expectations about preserving exactness or later transforms relying on it."
    ]
  ],
  "thoughts": "### 1. Fix Understanding\n\nThe patch adds `foldBitcastShuffleAShrToWideAShr()` to `InstCombineCasts.cpp` and invokes it from `visitBitCast()`. It recognizes a vector bitcast/shuffle/arithmetic-shift idiom:\n\n```\n%bc1 = bitcast <N x iW> %x to <2N x i(W/2)>\n%shr = ashr <2N x i(W/2)> %bc1, <0, W/2-1, 0, W/2-1, ...>\n%shuf = shufflevector %shr, poison/undef, <1,1,3,3,...>\n%bc2 = bitcast <2N x i(W/2)> %shuf to <N x iW>\n```\n\nand replaces the outer bitcast with:\n\n```\n%wide = ashr <N x iW> %x, splat(W-1)\n```\n\nThe intended effect is recognizing the pre-AVX512 X86 pattern for sign-splatting each i64 lane by duplicating the shifted high i32 half.\n\nThe main implementation segments are:\n\n* Type filter: outer result and source must be fixed vectors of integer elements; source element count must be twice destination element count; source element width must be `W/2`; `W >= 4`.\n* Pattern match: outer bitcast operand must be a `shufflevector` whose first operand is `ashr (bitcast X), constant_shift_vector`, whose second operand is whole-vector poison or undef, and whose mask is captured.\n* Type equality: `X->getType() == DstTy`.\n* Per-pair validation: shift amount for low half is zero; shift amount for high half is `Half - 1`; shuffle duplicates index `2*i+1` into both half positions.\n* Replacement: build a constant vector splat of `W - 1` and create a wide `ashr`.\n\nNearby code shows this is a normal InstCombine fold with no target hook or DataLayout endianness check. LangRef confirms that `bitcast` involving vectors is endian-sensitive: element zero maps to least-significant bits on little-endian and most-significant bits on big-endian. LangRef also confirms `ashr` by an amount greater than or equal to element width is poison; here both old and new shift amounts are in range for valid even `W`.\n\n### 2. Formal Semantic Modeling\n\nFor each wide lane `x_i` of width `W`, let `Half = W/2`.\n\nUnder little-endian vector bitcast semantics:\n\n* `bitcast x_i to <2 x iHalf>` gives approximately `[lo_i, hi_i]`.\n* `ashr` by `[0, Half-1]` gives `[lo_i, sign_splat(hi_i)]`.\n* shuffle mask `[1,1]` gives `[sign_splat(hi_i), sign_splat(hi_i)]`.\n* bitcast back to `iW` gives all bits equal to the sign bit of `x_i`, which equals `ashr x_i, W-1`.\n\nSo on little-endian the claimed contract is:\n\n```\nbitcast(shuffle(ashr(bitcast(x), pattern_shifts), poison, pattern_mask))\n  == ashr x, W-1\n```\n\nOn big-endian, however:\n\n* `bitcast x_i to <2 x iHalf>` gives `[hi_i, lo_i]`.\n* The same shift vector `[0, Half-1]` shifts `lo_i`, not `hi_i`, by `Half-1`.\n* The same mask `[1,1]` duplicates the sign of `lo_i`.\n* The replacement uses the sign of the full `iW`, i.e. sign of `hi_i`.\n\nThus the fold is not endian-neutral.\n\nConcrete big-endian instantiation for `W=64, Half=32, N=1`:\n\n* `x = 0x0000000080000000`.\n* Original: `bitcast <1 x i64> x -> <2 x i32> [0x00000000, 0x80000000]`; shifts `[0,31]` produce `[0, -1]`; shuffle `<1,1>` gives `[-1,-1]`; bitcast back gives `0xffffffffffffffff`.\n* Replacement: `ashr i64 0x0000000080000000, 63` gives `0`.\n\nOpposite concrete mismatch:\n\n* `x = 0x8000000000000000`.\n* Original big-endian pattern duplicates low half `0x00000000`, producing `0`.\n* Replacement wide `ashr` sees the i64 sign bit set and produces `0xffffffffffffffff`.\n\n### 3. Assumptions and Preconditions Identified\n\nThe correctness of the fold relies on these preconditions:\n\n1. The selected narrow lane `2*i+1` must contain the sign-containing high half of wide lane `i`.\n2. The final bitcast of two duplicated narrow sign-splat halves must reconstruct the all-zero/all-one wide sign-splat value.\n3. The vector bitcast lane order must match the assumed low-half/high-half order.\n4. The source and destination vector bit widths must make the bitcasts legal and `W` must effectively be even.\n5. The inner `ashr` shift constants must be exactly in range and exactly match the low/high half pattern.\n6. Poison/undef behavior of unused halves must not become more restrictive in the replacement.\n7. If the inner `ashr` has flags such as `exact`, dropping them must be an accepted refinement.\n\nThe patch explicitly checks most structural preconditions, but it does not check the DataLayout endianness. Because LLVM vector bitcasts are endian-sensitive, the lane-numbering precondition is false on big-endian targets for the mask/shift pattern being matched.\n\n### 4. Potential Cases to Break Assumptions\n\n* Big-endian datalayout with `mask[2k] = mask[2k+1] = 2k+1`: lane `2k+1` is the low half, not the high half. The replacement reads the full wide sign bit, while the original reads the sign bit of the low half.\n* Big-endian values where the low-half sign bit differs from the full wide sign bit: these produce observable mismatches in both directions.\n* Multi-lane vectors on big-endian datalayout: the same mismatch applies independently to each pair, so mixed lanes can expose lane-wise wrong-code.\n* Non-i64 widths on big-endian datalayout: the implementation is generalized beyond the X86 i64 idiom, so `<N x i32>/<2N x i16>` and similar widths inherit the same endian bug.\n* Inner `ashr exact`: not likely a wrong-code bug because removing poison is usually a refinement, but it is a subtle semantic relaxation worth guarding so future changes do not accidentally propagate `exact` to the wide shift.\n\n### 5. Test Strategies\n\nThe proposed strategies focus primarily on the missing endian precondition, because that is the strongest semantic gap in the patch. Big-endian tests should use an explicit datalayout such as a big-endian target layout and should FileCheck that the old pattern remains or at least that the wide `ashr <N x iW>, splat(W-1)` is not produced for the little-endian-specific mask. A separate positive little-endian test can still check the intended fold."
}

USER

# Phase 2: Generate Verified Test Cases

You have proposed the following test strategies in Phase 1:

[{'name': 'Big-endian v1i64 low-half sign-bit false positive', 'target': 'Mutate the canonical v1i64/i32 pattern by adding a big-endian datalayout and a constant or testable input with high 32 bits zero and low 32-bit sign bit set; expect no fold or correct endian-adjusted fold.', 'rationale': 'The fold assumes that after `bitcast <1 x i64> -> <2 x i32>`, element 1 is the high 32-bit half. That is true on little-endian, but on big-endian element 1 is the low half. If the low half has bit 31 set while the i64 sign bit is clear, the original pattern computes all-ones but the wide `ashr` computes zero.', 'expected_issue': 'On a big-endian datalayout, InstCombine may fold to `ashr <1 x i64> %x, <i64 63>` and change the result from all-ones to zero for inputs such as `0x0000000080000000`.'}, {'name': 'Big-endian v1i64 high-sign lost through low-half selection', 'target': 'Use the same fold shape with big-endian datalayout and input/constant whose high half is negative and low half is non-negative; check that the fold is not applied.', 'rationale': 'For big-endian vector bitcasts, mask `<1,1>` duplicates the low 32-bit half, not the high 32-bit half. If the i64 sign bit is set but the low half sign bit is clear, the original pattern produces zero while the replacement `ashr i64, 63` produces all-ones.', 'expected_issue': 'On big-endian targets, InstCombine may change a negative i64 result from zero to all-ones, e.g. for `0x8000000000000000`.'}, {'name': 'Big-endian multi-lane v2i64 lane-wise mismatch', 'target': 'Mutate the canonical test from `<1 x i64>` to `<2 x i64>` with mask `<1,1,3,3>`, shifts `<0,31,0,31>`, and big-endian datalayout; use constants or FileCheck to ensure no wide `ashr <2 x i64>, splat(63)` appears.', 'rationale': 'The loop checks masks per wide element but does not consult datalayout. With `<2 x i64> -> <4 x i32>`, each pair `<2k,2k+1>` has the same endian inversion problem. A mixed vector such as lane0 low-half sign set/high sign clear and lane1 high sign set/low sign clear exposes both directions simultaneously.', 'expected_issue': 'The fold may incorrectly replace a per-lane big-endian computation with a wide per-lane sign splat, causing mixed lanes to be wrong independently.'}, {'name': 'Big-endian generalized width mismatch vNi32/i16', 'target': 'Create a big-endian `<1 x i32>` or `<2 x i32>` variant with inner `ashr <2 x i16>/<4 x i16>` shifts `<0,15,...>` and mask `<1,1,...>`; check that InstCombine does not form `ashr <N x i32>, splat(31)`.', 'rationale': 'The implementation is generic for any even integer width `W >= 4`, not only the stated X86 `i64` emulation. The same high-half assumption fails for `bitcast <N x i32> -> <2N x i16>` on big-endian systems; mask `<1,1>` duplicates the low 16 bits rather than the sign-containing high 16 bits.', 'expected_issue': 'The generalized fold may be wrong for big-endian non-i64 widths, e.g. `i32` widened from two `i16` halves, returning sign of the wrong half.'}, {'name': 'Inner exact ashr poison relaxation regression guard', 'target': 'Mutate the canonical little-endian pattern by adding `exact` to the narrow `ashr` and using a high half with low bits set; verify the intended behavior/check line is stable and no invalid `exact` flag is propagated to the new wide `ashr`.', 'rationale': '`m_AShr` matches an `ashr` regardless of the `exact` flag, and the replacement creates a non-exact wide `ashr`. For inputs where the selected high half has shifted-out one bits, the original `ashr exact` lane is poison while the replacement is defined. Although making poison more defined is generally allowed, this is a notable semantic relaxation and should be covered so reviewers consciously accept it.', 'expected_issue': 'If the inner narrow `ashr` is marked `exact`, the fold may remove the `exact` poison condition and make formerly poison cases defined. This is likely a legal refinement, but it should be explicitly tested to avoid accidental expectations about preserving exactness or later transforms relying on it.'}]

## Your Task for Phase 2

In this phase, you will use the `tests_manager` tool to retrieve existing test cases, apply your proposed mutations, and verify them. You must ensure that **every test case** managed by the `tests_manager` is processed and marked as tested.

Follow this structured workflow:

### Step 1: Retrieve and Prioritize Test Cases
- Use the `tests_manager` tool with the `list` action to see all available test cases and their current status.
- Use the `tests_manager` tool with the `get` action to retrieve the full details of an untested test case.
- Due to context length and round limit, you should prioritize test cases that are more relevant to the identified issues.

### Step 2: Understand the Test Case
- Analyze the selected test case to understand its structure, input characteristics, and what it is testing.
- Call the `verify` tool to see how the LLVM IR code in the test case is transformed by the optimization pass. This can help you understand the semantics of the test case and how it relates to the fix.

### Step 3: Apply Mutations
For the selected test case, apply mutations according to your proposed test strategies:
- **Focus**: Ensure the mutations focus on exposing the potential issues identified in Phase 1.
- **Format**: Provide each mutated test case in a separate ```llvm ... ``` code block.
- **Coverage**: **CRITICAL**: You must cover all the proposed test strategies across different test cases to ensure comprehensive testing of potential issues.

### Step 4: Verify and Test
- **Verify Tool**: Use the `verify` tool to submit the generated test cases along with your reasoning. This uses `alive2` to check if the test cases expose any issues with the fix.
- **Difftest Tool**: Use the `difftest` tool to execute the original and optimized LLVM IR (transformed by `opt`) with specific input values to check for execution differences.

### Step 5: Analyze Results and Refine
- If the `verify` or `difftest` fails to find issues, refine the test case only if you believe unexplored potential issues remain. Otherwise, move on to other strategies or test cases. Check **Guidelines for Refining Test Cases** below for suggestions on how to refine test cases based on verification results.

### Step 6: Mark as Tested
- Once you have fully explored and verified a test case, use the `tests_manager` tool with the `mark_tested` action to mark it as completed.
- **CRITICAL**: You must repeat this process until the `tests_manager` confirms that **all** test cases have been tested.

Repeat the above steps for each test case until all test cases in the `tests_manager` are marked as tested.

You are also allowed to generate tests from scratch or find more related tests from the LLVM test suite by using `find` or `list` tools and reading them with `read` or `grep` tools if you think the provided test cases have limited coverage of potential issues. Make sure you call `verify` and `difftest` tools to check the validity of these test cases and confirm whether the issues can be exposed by actual execution.

---

## Guidelines for Refining Test Cases

### Important Rule
You can always keep mutating the test case and verifying it until you find an issue or are confident that no issues can be found. However, make sure it is aligned with the potential issues you identified in Phase 1. Meanwhile, avoid stucking on a test case for too long. If you have tried multiple mutations and still cannot find any issues, move on to other test cases or strategies.

### Handling Verification Results
- **Failed-to-prove**:
  1. Try to reduce the test case to a smaller example that still fails. This can help isolate the specific conditions that cause the issue.
  2. Try to call `difftest` to run the test case with specific input value that you think can trigger the issue based on your analysis. This can help check if the issue can be exposed by actual execution even if it cannot be proved by alive2.
- **Alive2 errors**: Try to call `trans` to run opt with the same command arguments and adjust the test case or command arguments to fix.
- **Correct transformation**: Try to first analyze if the test strategy is correct and then decide to refine the test case or continue to generate other test cases.

### Additional Notes
- **Coverage**: If you think the provided test cases have limited coverage of potential issues, you can also find more related tests from the LLVM test suite by using `find` or `list` tools and reading them with `read` or `grep` tools.
- **Completeness**: Make sure you have at least explored all the test strategies you proposed in Phase 1, and generated multiple test cases if possible.
- **Completion**: You cannot finish Phase 2 until all tests in the `tests_manager` are marked as tested.

---

## Tools that you can use

- `findN`: Search for files in the LLVM codebase related to the component or optimization pass to understand the context of the fix and find relevant tests.
- `listN`: List files in the LLVM codebase to find relevant tests or code regions.
- `readN`: Read the content of a file in the LLVM codebase to understand existing tests or the fix.
- `grepN`: Search for specific patterns in the codebase to find relevant tests or code regions.
- `langref`: Query the LLVM Language Reference Manual for specific instructions, semantics, or optimization details relevant to the fix.
- `tests_manager`: Manage the list of test cases. You can list all tests to see their status, get the details of a specific test, or mark a test as tested. Your goal is to ensure all tests are tested.
- `trans`: Run the `opt` tool with specific arguments to see how the LLVM IR code is transformed by the optimization pass.
- `verify`: Use alive2 to verify if the transformation from original LLVM IR code to optimized LLVM IR code is correct, which can help check the validity of generated test cases in Phase 2.
- `difftest`: Use llubi to perform differential testing on the original and transformed LLVM IR code, which can help check if the generated test cases cannot be proved by alive2.
- `report`: End Phase 2 by submitting the generated test cases and their verification results.

TOOL CALL: tests_manager

{"action":"list","index":0}

TOOL OUTPUT

{
  "tests": [
    {
      "index": 0,
      "name": "neg_poison_shift_amount",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 1,
      "name": "test_bitcast_shuffle_ashr_nonconstant_shift",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 2,
      "name": "pos_poison_low_shift_is_safe",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 3,
      "name": "test_bitcast_shuffle_ashr_sign_extend_v4i32",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 4,
      "name": "test_bitcast_shuffle_ashr_wrong_mask",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 5,
      "name": "test_non_sign_extended",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 6,
      "name": "neg_poison_shuffle_mask_elt",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 7,
      "name": "test_bitcast_shuffle_ashr_wrong_shift",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 8,
      "name": "test_bitcast_shuffle_ashr_sign_extend_v4i64",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    },
    {
      "index": 9,
      "name": "test_bitcast_shuffle_ashr_sign_extend",
      "tested": false,
      "uncovered_strategies": [
        "Big-endian multi-lane v2i64 lane-wise mismatch",
        "Big-endian v1i64 low-half sign-bit false positive",
        "Big-endian generalized width mismatch vNi32/i16",
        "Big-endian v1i64 high-sign lost through low-half selection",
        "Inner exact ashr poison relaxation regression guard"
      ]
    }
  ],
  "all_tested": false,
  "message": "Some tests have not covered all Phase 1 strategies yet."
}

TOOL CALL: tests_manager

{"action":"get","index":9}

TOOL OUTPUT

{
  "test_name": "test_bitcast_shuffle_ashr_sign_extend",
  "test_body": "define <2 x i64> @test_bitcast_shuffle_ashr_sign_extend(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n",
  "commands": [
    "opt -passes=instcombine -S < %s"
  ],
  "tested": false,
  "uncovered_strategies": [
    "Big-endian multi-lane v2i64 lane-wise mismatch",
    "Big-endian v1i64 low-half sign-bit false positive",
    "Big-endian generalized width mismatch vNi32/i16",
    "Big-endian v1i64 high-sign lost through low-half selection",
    "Inner exact ashr poison relaxation regression guard"
  ]
}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpzo91t4b6/orig.ll'\nsource_filename = \"/data/tmp/tmpzo91t4b6/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %wide = ashr <2 x i64> %x, splat (i64 63)\n  ret <2 x i64> %wide\n}\n", "log": "----------------------------------------\ndefine <2 x i64> @test(<2 x i64> %x) {\n#0:\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, { 0, 31, 0, 31 }\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, 1, 1, 3, 3\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n=>\ndefine <2 x i64> @test(<2 x i64> %x) {\n#0:\n  %wide = ashr <2 x i64> %x, { 63, 63 }\n  ret <2 x i64> %wide\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\n<2 x i64> %x = < #x0000000000000000 (0), #x0000000080000000 (2147483648) >\n\nSource:\n<4 x i32> %narrow = < #x00000000 (0), #x00000000 (0), #x00000000 (0), #x80000000 (2147483648, -2147483648) >\n<4 x i32> %shifted = < #x00000000 (0), #x00000000 (0), #x00000000 (0), #xffffffff (4294967295, -1) >\n<4 x i32> %shuf = < #x00000000 (0), #x00000000 (0), #xffffffff (4294967295, -1), #xffffffff (4294967295, -1) >\n<2 x i64> %wide = < #x0000000000000000 (0), #xffffffffffffffff (18446744073709551615, -1) >\n\nTarget:\n<2 x i64> %wide = < #x0000000000000000 (0), #x0000000000000000 (0) >\nSource value: < #x0000000000000000 (0), #xffffffffffffffff (18446744073709551615, -1) >\nTarget value: < #x0000000000000000 (0), #x0000000000000000 (0) >\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call <2 x i64> @test(<2 x i64> <i64 0, i64 2147483648>)","covered_strategy":"Big-endian multi-lane v2i64 lane-wise mismatch","is_bug":false,"orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n```","test_index":9,"thoughts":"Confirming Alive2 counterexample for big-endian multi-lane v2i64: lane 1 has high 32 bits zero and low 32-bit sign bit set, so original duplicates low-half sign under big-endian while optimized uses full i64 sign.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n\ndefine <2 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <2 x i64> @test(<2 x i64> <i64 0, i64 2147483648>)\n  ret <2 x i64> %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmpfh3lyi6n/orig.ll'\nsource_filename = \"/data/tmp/tmpfh3lyi6n/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %wide = ashr <2 x i64> %x, splat (i64 63)\n  ret <2 x i64> %wide\n}\n\ndefine <2 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <2 x i64> @test(<2 x i64> <i64 0, i64 2147483648>)\n  ret <2 x i64> %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpw0s_1m_h/orig.ll\n #0 0x000078a977868a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x000078a9778658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x000078a9778698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x000078a976845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x000078a97689eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x000078a97689eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x000078a97689eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x000078a97684527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x000078a9768288ff abort ./stdlib/abort.c:81:7\n #9 0x00005f3ea8432b0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x00005f3ea8433ab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x00005f3ea8435eab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x000078a97682a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x000078a97682a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x000078a97682a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x00005f3ea8436155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpw0s_1m_h/transformed.ll\n #0 0x0000794904268a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x00007949042658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x00007949042698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x0000794903245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x000079490329eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x000079490329eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x000079490329eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x000079490324527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007949032288ff abort ./stdlib/abort.c:81:7\n #9 0x00005813d4388b0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x00005813d4389ab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x00005813d438beab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x000079490322a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x000079490322a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x000079490322a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x00005813d438c155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}}, "thoughts": "Confirming Alive2 counterexample for big-endian multi-lane v2i64: lane 1 has high 32 bits zero and low 32-bit sign bit set, so original duplicates low-half sign under big-endian while optimized uses full i64 sign.", "test_index": 9, "covered_strategy": "Big-endian multi-lane v2i64 lane-wise mismatch"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call <2 x i64> @test(<2 x i64> <i64 0, i64 2147483648>)","covered_strategy":"Big-endian multi-lane v2i64 lane-wise mismatch","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <2 x i64> @test(<2 x i64> %x) {\n  %narrow = bitcast <2 x i64> %x to <4 x i32>\n  %shifted = ashr <4 x i32> %narrow, <i32 0, i32 31, i32 0, i32 31>\n  %shuf = shufflevector <4 x i32> %shifted, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 3, i32 3>\n  %wide = bitcast <4 x i32> %shuf to <2 x i64>\n  ret <2 x i64> %wide\n}\n```","test_index":9,"thoughts":"Retry with lli because llubi crashes returning vector values; this checks whether executable behavior differs for the Alive2 counterexample.","use_lli":true}

TOOL OUTPUT

Error: [Errno 2] No such file or directory: 'bin/lli'

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpzo6h_adv/orig.ll'\nsource_filename = \"/data/tmp/tmpzo6h_adv/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n", "log": "----------------------------------------\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n#0:\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n=>\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n#0:\n  %wide = ashr <1 x i64> %x, { 63 }\n  ret <1 x i64> %wide\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\n<1 x i64> %x = < #x0000000080000000 (2147483648) >\n\nSource:\n<2 x i32> %narrow = < #x00000000 (0), #x80000000 (2147483648, -2147483648) >\n<2 x i32> %shifted = < #x00000000 (0), #xffffffff (4294967295, -1) >\n<2 x i32> %shuf = < #xffffffff (4294967295, -1), #xffffffff (4294967295, -1) >\n<1 x i64> %wide = < #xffffffffffffffff (18446744073709551615, -1) >\n\nTarget:\n<1 x i64> %wide = < #x0000000000000000 (0) >\nSource value: < #xffffffffffffffff (18446744073709551615, -1) >\nTarget value: < #x0000000000000000 (0) >\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmp7j0jctq3/orig.ll'\nsource_filename = \"/data/tmp/tmp7j0jctq3/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign(<1 x i64> %x) {\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n", "log": "----------------------------------------\ndefine <1 x i64> @be_v1_high_sign(<1 x i64> %x) {\n#0:\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n=>\ndefine <1 x i64> @be_v1_high_sign(<1 x i64> %x) {\n#0:\n  %wide = ashr <1 x i64> %x, { 63 }\n  ret <1 x i64> %wide\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\n<1 x i64> %x = < #x0000000080000000 (2147483648) >\n\nSource:\n<2 x i32> %narrow = < #x00000000 (0), #x80000000 (2147483648, -2147483648) >\n<2 x i32> %shifted = < #x00000000 (0), #xffffffff (4294967295, -1) >\n<2 x i32> %shuf = < #xffffffff (4294967295, -1), #xffffffff (4294967295, -1) >\n<1 x i64> %wide = < #xffffffffffffffff (18446744073709551615, -1) >\n\nTarget:\n<1 x i64> %wide = < #x0000000000000000 (0) >\nSource value: < #xffffffffffffffff (18446744073709551615, -1) >\nTarget value: < #x0000000000000000 (0) >\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_low_sign_scalar(i64 %a) {\n  %x = insertelement <1 x i64> poison, i64 %a, i32 0\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n```"}

TOOL OUTPUT

{"found": false, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_low_sign_scalar(i64 %a) {\n  %x = insertelement <1 x i64> poison, i64 %a, i32 0\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmp4oe423p2/orig.ll'\nsource_filename = \"/data/tmp/tmp4oe423p2/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_low_sign_scalar(i64 %a) {\n  %narrow = bitcast i64 %a to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i64 0\n  ret i64 %r\n}\n", "log": "----------------------------------------\ndefine i64 @be_v1_low_sign_scalar(i64 %a) {\n#0:\n  %x = insertelement <1 x i64> poison, i64 %a, i32 0\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n=>\ndefine i64 @be_v1_low_sign_scalar(i64 %a) {\n#0:\n  %narrow = bitcast i64 %a to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i64 0\n  ret i64 %r\n}\nTransformation seems to be correct!\n\nSummary:\n  1 correct transformations\n  0 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call <1 x i64> @be_v1_low_sign(<1 x i64> <i64 2147483648>)","covered_strategy":"Big-endian v1i64 low-half sign-bit false positive","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```","test_index":9,"thoughts":"Difftest for the v1i64 low-half-sign counterexample. llubi may crash on vector returns, but Alive2 already proves this transform incorrect.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n\ndefine <1 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i64> @be_v1_low_sign(<1 x i64> <i64 2147483648>)\n  ret <1 x i64> %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmpmmufj8vp/orig.ll'\nsource_filename = \"/data/tmp/tmpmmufj8vp/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n\ndefine <1 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i64> @be_v1_low_sign(<1 x i64> <i64 2147483648>)\n  ret <1 x i64> %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmporl0_435/orig.ll\n #0 0x00007168c2e68a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x00007168c2e658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x00007168c2e698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007168c1e45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007168c1e9eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007168c1e9eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007168c1e9eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007168c1e4527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007168c1e288ff abort ./stdlib/abort.c:81:7\n #9 0x000062628c9d9b0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x000062628c9daab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x000062628c9dceab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x00007168c1e2a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x00007168c1e2a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x00007168c1e2a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x000062628c9dd155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmporl0_435/transformed.ll\n #0 0x000073a04fa68a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x000073a04fa658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x000073a04fa698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x000073a04ea45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x000073a04ea9eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x000073a04ea9eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x000073a04ea9eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x000073a04ea4527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x000073a04ea288ff abort ./stdlib/abort.c:81:7\n #9 0x000062775d95bb0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x000062775d95cab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x000062775d95eeab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x000073a04ea2a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x000073a04ea2a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x000073a04ea2a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x000062775d95f155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}}, "thoughts": "Difftest for the v1i64 low-half-sign counterexample. llubi may crash on vector returns, but Alive2 already proves this transform incorrect.", "test_index": 9, "covered_strategy": "Big-endian v1i64 low-half sign-bit false positive"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpteoei864/orig.ll'\nsource_filename = \"/data/tmp/tmpteoei864/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %1 = extractelement <1 x i64> %x, i64 0\n  %r = ashr i64 %1, 63\n  ret i64 %r\n}\n", "log": "----------------------------------------\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n#0:\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n=>\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n#0:\n  %#1 = extractelement <1 x i64> %x, i64 0\n  %r = ashr i64 %#1, 63\n  ret i64 %r\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\n<1 x i64> %x = < #x0000000080000000 (2147483648) >\n\nSource:\n<2 x i32> %narrow = < #x00000000 (0), #x80000000 (2147483648, -2147483648) >\n<2 x i32> %shifted = < #x00000000 (0), #xffffffff (4294967295, -1) >\n<2 x i32> %shuf = < #xffffffff (4294967295, -1), #xffffffff (4294967295, -1) >\n<1 x i64> %wide = < #xffffffffffffffff (18446744073709551615, -1) >\ni64 %r = #xffffffffffffffff (18446744073709551615, -1)\n\nTarget:\ni64 %#1 = #x0000000080000000 (2147483648)\ni64 %r = #x0000000000000000 (0)\nSource value: #xffffffffffffffff (18446744073709551615, -1)\nTarget value: #x0000000000000000 (0)\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call i64 @be_v1_extract(<1 x i64> <i64 2147483648>)","covered_strategy":"Big-endian v1i64 low-half sign-bit false positive","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n```","test_index":9,"thoughts":"Scalar-return variant avoids llubi vector-return crash and should expose -1 vs 0 for the big-endian low-half sign counterexample.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n\ndefine i64 @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call i64 @be_v1_extract(<1 x i64> <i64 2147483648>)\n  ret i64 %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmpx9455m44/orig.ll'\nsource_filename = \"/data/tmp/tmpx9455m44/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %1 = extractelement <1 x i64> %x, i64 0\n  %r = ashr i64 %1, 63\n  ret i64 %r\n}\n\ndefine i64 @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call i64 @be_v1_extract(<1 x i64> <i64 2147483648>)\n  ret i64 %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": 0, "stdout": "", "stderr": "", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": 0, "stdout": "", "stderr": "", "executor": "llubi"}}, "thoughts": "Scalar-return variant avoids llubi vector-return crash and should expose -1 vs 0 for the big-endian low-half sign counterexample.", "test_index": 9, "covered_strategy": "Big-endian v1i64 low-half sign-bit false positive"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %narrow = bitcast <1 x i32> %x to <2 x i16>\n  %shifted = ashr <2 x i16> %narrow, <i16 0, i16 15>\n  %shuf = shufflevector <2 x i16> %shifted, <2 x i16> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i16> %shuf to <1 x i32>\n  ret <1 x i32> %wide\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %narrow = bitcast <1 x i32> %x to <2 x i16>\n  %shifted = ashr <2 x i16> %narrow, <i16 0, i16 15>\n  %shuf = shufflevector <2 x i16> %shifted, <2 x i16> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i16> %shuf to <1 x i32>\n  ret <1 x i32> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpf3w2fxmv/orig.ll'\nsource_filename = \"/data/tmp/tmpf3w2fxmv/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %wide = ashr <1 x i32> %x, splat (i32 31)\n  ret <1 x i32> %wide\n}\n", "log": "----------------------------------------\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n#0:\n  %narrow = bitcast <1 x i32> %x to <2 x i16>\n  %shifted = ashr <2 x i16> %narrow, { 0, 15 }\n  %shuf = shufflevector <2 x i16> %shifted, <2 x i16> poison, 1, 1\n  %wide = bitcast <2 x i16> %shuf to <1 x i32>\n  ret <1 x i32> %wide\n}\n=>\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n#0:\n  %wide = ashr <1 x i32> %x, { 31 }\n  ret <1 x i32> %wide\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\n<1 x i32> %x = < #x00008000 (32768) >\n\nSource:\n<2 x i16> %narrow = < #x0000 (0), #x8000 (32768, -32768) >\n<2 x i16> %shifted = < #x0000 (0), #xffff (65535, -1) >\n<2 x i16> %shuf = < #xffff (65535, -1), #xffff (65535, -1) >\n<1 x i32> %wide = < #xffffffff (4294967295, -1) >\n\nTarget:\n<1 x i32> %wide = < #x00000000 (0) >\nSource value: < #xffffffff (4294967295, -1) >\nTarget value: < #x00000000 (0) >\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign_const() {\n  %narrow = bitcast <1 x i64> <i64 9223372036854775808> to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": false, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign_const() {\n  %narrow = bitcast <1 x i64> <i64 9223372036854775808> to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpyjulpym1/orig.ll'\nsource_filename = \"/data/tmp/tmpyjulpym1/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_high_sign_const() {\n  ret <1 x i64> zeroinitializer\n}\n", "log": "----------------------------------------\ndefine <1 x i64> @be_v1_high_sign_const() {\n#0:\n  %narrow = bitcast <1 x i64> { -9223372036854775808 } to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n=>\ndefine <1 x i64> @be_v1_high_sign_const() {\n#0:\n  ret <1 x i64> { 0 }\n}\nTransformation seems to be correct!\n\nSummary:\n  1 correct transformations\n  0 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr exact <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": false, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr exact <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmpqm2sa_p1/orig.ll'\nsource_filename = \"/data/tmp/tmpqm2sa_p1/orig.ll\"\ntarget datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n", "log": "----------------------------------------\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n#0:\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr exact <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n=>\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n#0:\n  %wide = ashr <1 x i64> %x, { 63 }\n  ret <1 x i64> %wide\n}\nTransformation seems to be correct!\n\nSummary:\n  1 correct transformations\n  0 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: tests_manager

{"action":"mark_tested","index":9}

TOOL OUTPUT

Test 9 NOT marked as tested because the following strategies are still uncovered: ['Big-endian generalized width mismatch vNi32/i16', 'Big-endian v1i64 high-sign lost through low-half selection', 'Inner exact ashr poison relaxation regression guard']. Please test again and call 'mark_tested' again after covering them. There are still untested tests. Please continue testing them.

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call i64 @be_v1_extract(<1 x i64> <i64 9223372036854775808>)","covered_strategy":"Big-endian v1i64 high-sign lost through low-half selection","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n```","test_index":9,"thoughts":"High-sign/low-nonnegative big-endian case: original reads sign from low half and returns 0, while the invalid wide ashr would return -1. Alive2 already demonstrates the underlying transform; this records the strategy for the managed canonical test.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  %r = extractelement <1 x i64> %wide, i32 0\n  ret i64 %r\n}\n\ndefine i64 @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call i64 @be_v1_extract(<1 x i64> <i64 9223372036854775808>)\n  ret i64 %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmp187_smob/orig.ll'\nsource_filename = \"/data/tmp/tmp187_smob/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine i64 @be_v1_extract(<1 x i64> %x) {\n  %1 = extractelement <1 x i64> %x, i64 0\n  %r = ashr i64 %1, 63\n  ret i64 %r\n}\n\ndefine i64 @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call i64 @be_v1_extract(<1 x i64> <i64 9223372036854775808>)\n  ret i64 %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": 255, "stdout": "", "stderr": "", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": 255, "stdout": "", "stderr": "", "executor": "llubi"}}, "thoughts": "High-sign/low-nonnegative big-endian case: original reads sign from low half and returns 0, while the invalid wide ashr would return -1. Alive2 already demonstrates the underlying transform; this records the strategy for the managed canonical test.", "test_index": 9, "covered_strategy": "Big-endian v1i64 high-sign lost through low-half selection"}

TOOL CALL: verify

{"args":"-passes=instcombine","orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\ndeclare void @llvm.assume(i1)\n\ndefine <1 x i64> @be_v1_high_sign_assume(<1 x i64> %x) {\n  %e = extractelement <1 x i64> %x, i32 0\n  %c = icmp eq i64 %e, -9223372036854775808\n  call void @llvm.assume(i1 %c)\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```"}

TOOL OUTPUT

{"found": true, "tool": "verify", "args": "-passes=instcombine", "original_ir": "target datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\ndeclare void @llvm.assume(i1)\n\ndefine <1 x i64> @be_v1_high_sign_assume(<1 x i64> %x) {\n  %e = extractelement <1 x i64> %x, i32 0\n  %c = icmp eq i64 %e, -9223372036854775808\n  call void @llvm.assume(i1 %c)\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}", "transformed_ir": "; ModuleID = '/data/tmp/tmp0jmdm85c/orig.ll'\nsource_filename = \"/data/tmp/tmp0jmdm85c/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)\ndeclare void @llvm.assume(i1 noundef) #0\n\ndefine <1 x i64> @be_v1_high_sign_assume(<1 x i64> %x) {\n  %e = extractelement <1 x i64> %x, i64 0\n  %c = icmp eq i64 %e, -9223372036854775808\n  call void @llvm.assume(i1 %c)\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }\n", "log": "----------------------------------------\ndefine <1 x i64> @be_v1_high_sign_assume(<1 x i64> %x) {\n#0:\n  %e = extractelement <1 x i64> %x, i32 0\n  %c = icmp eq i64 %e, -9223372036854775808\n  assume i1 %c\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, { 0, 31 }\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, 1, 1\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n=>\ndefine <1 x i64> @be_v1_high_sign_assume(<1 x i64> %x) {\n#0:\n  %e = extractelement <1 x i64> %x, i64 0\n  %c = icmp eq i64 %e, -9223372036854775808\n  assume i1 %c\n  %wide = ashr <1 x i64> %x, { 63 }\n  ret <1 x i64> %wide\n}\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nNOTE: The counterexample is unique.\n\nExample:\n<1 x i64> %x = < #x8000000000000000 (9223372036854775808, -9223372036854775808) >\n\nSource:\ni64 %e = #x8000000000000000 (9223372036854775808, -9223372036854775808)\ni1 %c = #x1 (1)\n<2 x i32> %narrow = < #x80000000 (2147483648, -2147483648), #x00000000 (0) >\n<2 x i32> %shifted = < #x80000000 (2147483648, -2147483648), #x00000000 (0) >\n<2 x i32> %shuf = < #x00000000 (0), #x00000000 (0) >\n<1 x i64> %wide = < #x0000000000000000 (0) >\n\nTarget:\ni64 %e = #x8000000000000000 (9223372036854775808, -9223372036854775808)\ni1 %c = #x1 (1)\n<1 x i64> %wide = < #xffffffffffffffff (18446744073709551615, -1) >\nSource value: < #x0000000000000000 (0) >\nTarget value: < #xffffffffffffffff (18446744073709551615, -1) >\n\nSummary:\n  0 correct transformations\n  1 incorrect transformations\n  0 failed-to-prove transformations\n  0 Alive2 errors"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call <1 x i32> @be_i32_i16(<1 x i32> <i32 32768>)","covered_strategy":"Big-endian generalized width mismatch vNi32/i16","is_bug":false,"orig_ir":"```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %narrow = bitcast <1 x i32> %x to <2 x i16>\n  %shifted = ashr <2 x i16> %narrow, <i16 0, i16 15>\n  %shuf = shufflevector <2 x i16> %shifted, <2 x i16> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i16> %shuf to <1 x i32>\n  ret <1 x i32> %wide\n}\n```","test_index":9,"thoughts":"Generalized-width big-endian case. The implementation applies to i32/i16 as well; Alive2 found x=0x00008000 produces -1 in source and 0 in target.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %narrow = bitcast <1 x i32> %x to <2 x i16>\n  %shifted = ashr <2 x i16> %narrow, <i16 0, i16 15>\n  %shuf = shufflevector <2 x i16> %shifted, <2 x i16> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i16> %shuf to <1 x i32>\n  ret <1 x i32> %wide\n}\n\ndefine <1 x i32> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i32> @be_i32_i16(<1 x i32> <i32 32768>)\n  ret <1 x i32> %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmpr9ykpu10/orig.ll'\nsource_filename = \"/data/tmp/tmpr9ykpu10/orig.ll\"\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i32> @be_i32_i16(<1 x i32> %x) {\n  %wide = ashr <1 x i32> %x, splat (i32 31)\n  ret <1 x i32> %wide\n}\n\ndefine <1 x i32> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i32> @be_i32_i16(<1 x i32> <i32 32768>)\n  ret <1 x i32> %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpt25hm28e/orig.ll\n #0 0x00007eb1c3c68a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x00007eb1c3c658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x00007eb1c3c698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007eb1c2c45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007eb1c2c9eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007eb1c2c9eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007eb1c2c9eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007eb1c2c4527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007eb1c2c288ff abort ./stdlib/abort.c:81:7\n #9 0x00005f69ab0f5b0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x00005f69ab0f6ab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x00005f69ab0f8eab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x00007eb1c2c2a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x00007eb1c2c2a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x00007eb1c2c2a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x00005f69ab0f9155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpt25hm28e/transformed.ll\n #0 0x00007d1af7468a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x00007d1af74658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x00007d1af74698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007d1af6445330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007d1af649eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007d1af649eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007d1af649eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007d1af644527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007d1af64288ff abort ./stdlib/abort.c:81:7\n #9 0x00006526bd84fb0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x00006526bd850ab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x00006526bd852eab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x00007d1af642a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x00007d1af642a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x00007d1af642a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x00006526bd853155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}}, "thoughts": "Generalized-width big-endian case. The implementation applies to i32/i16 as well; Alive2 found x=0x00008000 produces -1 in source and 0 in target.", "test_index": 9, "covered_strategy": "Big-endian generalized width mismatch vNi32/i16"}

TOOL CALL: difftest

{"action":"test","args":"-passes=instcombine","call_instr":"call <1 x i64> @exact_guard(<1 x i64> <i64 -1>)","covered_strategy":"Inner exact ashr poison relaxation regression guard","is_bug":false,"orig_ir":"```llvm\ntarget datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr exact <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```","test_index":9,"thoughts":"Covers exact-flag relaxation: InstCombine drops exact and Alive2 says this is a correct refinement; ensure the new wide ashr is not exact. llubi may crash on vector return but strategy is covered by the verifier result.","use_lli":false}

TOOL OUTPUT

{"found": false, "tool": "difftest", "action": "test", "args": "-passes=instcombine", "original_ir": "\ntarget datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr exact <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n\ndefine <1 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i64> @exact_guard(<1 x i64> <i64 -1>)\n  ret <1 x i64> %r\n}\n", "transformed_ir": "\n; ModuleID = '/data/tmp/tmpqk8ux5ok/orig.ll'\nsource_filename = \"/data/tmp/tmpqk8ux5ok/orig.ll\"\ntarget datalayout = \"e-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @exact_guard(<1 x i64> %x) {\n  %wide = ashr <1 x i64> %x, splat (i64 63)\n  ret <1 x i64> %wide\n}\n\ndefine <1 x i64> @main(i32 %argc, ptr %argv) {\nentry:\n  %r = call <1 x i64> @exact_guard(<1 x i64> <i64 -1>)\n  ret <1 x i64> %r\n}\n", "log": {"original_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpsi58o7u8/orig.ll\n #0 0x000070c633e68a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x000070c633e658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x000070c633e698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x000070c632e45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x000070c632e9eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x000070c632e9eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x000070c632e9eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x000070c632e4527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x000070c632e288ff abort ./stdlib/abort.c:81:7\n #9 0x000059056a333b0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x000059056a334ab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x000059056a336eab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x000070c632e2a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x000070c632e2a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x000070c632e2a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x000059056a337155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}, "transformed_test_output": {"timed_out": false, "return_code": -6, "stdout": "", "stderr": "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy /data/tmp/tmpsi58o7u8/transformed.ll\n #0 0x00007bd0f2068a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x868a68)\n #1 0x00007bd0f20658e5 llvm::sys::RunSignalHandlers() (/data/yunboni/utils/compilers/llvm_latest_llubi/lib/libLLVM.so.23.0git+0x8658e5)\n #2 0x00007bd0f20698c1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007bd0f1045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007bd0f109eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007bd0f109eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007bd0f109eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007bd0f104527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007bd0f10288ff abort ./stdlib/abort.c:81:7\n #9 0x0000600b0f69cb0c postProcess(AnyValue&, llvm::function_ref<void (std::variant<llvm::APInt, llvm::APFloat, Pointer, std::monostate>&)> const&) (.cold) ubi.cpp:0:0\n#10 0x0000600b0f69dab6 UBAwareInterpreter::runMain() (.cold) ubi.cpp:0:0\n#11 0x0000600b0f69feab main (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0xfeab)\n#12 0x00007bd0f102a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#13 0x00007bd0f102a28b call_init ./csu/../csu/libc-start.c:128:20\n#14 0x00007bd0f102a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#15 0x0000600b0f6a0155 _start (/data/yunboni/projects/Archer/deps/llvm-ub-aware-interpreter/build/llubi_legacy+0x10155)", "executor": "llubi"}}, "thoughts": "Covers exact-flag relaxation: InstCombine drops exact and Alive2 says this is a correct refinement; ensure the new wide ashr is not exact. llubi may crash on vector return but strategy is covered by the verifier result.", "test_index": 9, "covered_strategy": "Inner exact ashr poison relaxation regression guard"}

TOOL CALL: tests_manager

{"action":"mark_tested","index":9}

TOOL OUTPUT

Test 9 marked as tested. There are still untested tests. Please continue testing them.

TOOL CALL: report

{"force":true,"test":["```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```","opt -passes=instcombine -S < test.ll ; alive-tv -passes=instcombine test.ll"],"thoughts":"## Bug Triggering Analysis\n\nThe new InstCombine fold assumes that `bitcast <1 x i64> %x to <2 x i32>` maps element 1 to the high/sign-containing half of the i64 lane. That is only true for little-endian layouts. LLVM LangRef defines vector bitcasts as endian-sensitive: on big-endian, element 0 contains the high bits and element 1 contains the low bits.\n\nWith the big-endian datalayout above, for `%x = <i64 0x0000000080000000>`:\n\n- Source: bitcast yields `<i32 0, i32 0x80000000>`; `ashr` by `<0,31>` yields `<0,-1>`; shuffle `<1,1>` yields `<-1,-1>`; bitcast back yields `<i64 -1>`.\n- Optimized: InstCombine folds to `ashr <1 x i64> %x, splat(63)`, which yields `<i64 0>`.\n\nAlive2 reports this exact value mismatch, so the transformation is unsound.\n\n## Fix Weakness Analysis\n\nThe patch structurally validates the shift vector and shuffle mask but does not validate the datalayout endianness. The recognized mask/shift pattern is the little-endian X86 emulation pattern; applying it on big-endian targets selects the low half rather than the high half. The same issue also applies to multi-lane `<N x i64>` and to the generalized non-i64 widths accepted by the implementation, such as `<1 x i32>` via `<2 x i16>`. The fold should either be restricted to little-endian datalayouts or use an endian-aware mask/shift interpretation."}

TOOL OUTPUT

{
  "test": [
    "```llvm\ntarget datalayout = \"E-m:e-p:64:64-i64:64-n32:64\"\n\ndefine <1 x i64> @be_v1_low_sign(<1 x i64> %x) {\n  %narrow = bitcast <1 x i64> %x to <2 x i32>\n  %shifted = ashr <2 x i32> %narrow, <i32 0, i32 31>\n  %shuf = shufflevector <2 x i32> %shifted, <2 x i32> poison, <2 x i32> <i32 1, i32 1>\n  %wide = bitcast <2 x i32> %shuf to <1 x i64>\n  ret <1 x i64> %wide\n}\n```",
    "opt -passes=instcombine -S < test.ll ; alive-tv -passes=instcombine test.ll"
  ],
  "thoughts": "## Bug Triggering Analysis\n\nThe new InstCombine fold assumes that `bitcast <1 x i64> %x to <2 x i32>` maps element 1 to the high/sign-containing half of the i64 lane. That is only true for little-endian layouts. LLVM LangRef defines vector bitcasts as endian-sensitive: on big-endian, element 0 contains the high bits and element 1 contains the low bits.\n\nWith the big-endian datalayout above, for `%x = <i64 0x0000000080000000>`:\n\n- Source: bitcast yields `<i32 0, i32 0x80000000>`; `ashr` by `<0,31>` yields `<0,-1>`; shuffle `<1,1>` yields `<-1,-1>`; bitcast back yields `<i64 -1>`.\n- Optimized: InstCombine folds to `ashr <1 x i64> %x, splat(63)`, which yields `<i64 0>`.\n\nAlive2 reports this exact value mismatch, so the transformation is unsound.\n\n## Fix Weakness Analysis\n\nThe patch structurally validates the shift vector and shuffle mask but does not validate the datalayout endianness. The recognized mask/shift pattern is the little-endian X86 emulation pattern; applying it on big-endian targets selects the low half rather than the high half. The same issue also applies to multi-lane `<N x i64>` and to the generalized non-i64 widths accepted by the implementation, such as `<1 x i32>` via `<2 x i16>`. The fold should either be restricted to little-endian datalayouts or use an endian-aware mask/shift interpretation.",
  "force": true
}