diff options
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
| -rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 12a3193e6375..c4c174977c47 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -5181,6 +5181,10 @@ Value *llvm::simplifyInsertElementInst(Value *Vec, Value *Val, Value *Idx, (Q.isUndefValue(Val) && isGuaranteedNotToBePoison(Vec))) return Vec; + // Inserting the splatted value into a constant splat does nothing. + if (VecC && ValC && VecC->getSplatValue() == ValC) + return Vec; + // If we are extracting a value from a vector, then inserting it into the same // place, that's the input vector: // insertelt Vec, (extractelt Vec, Idx), Idx --> Vec |
