summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-05-23 21:49:47 +0000
committerSanjay Patel <spatel@rotateright.com>2019-05-23 21:49:47 +0000
commite60cb7d1be4aac850c69486cf69f0c5fe250e3af (patch)
tree907607be2f8276beb6a77c9e213d71e75e11793e /llvm/lib/Analysis/InstructionSimplify.cpp
parent5bc40d9b188bb43e2aafafe58d8d169cc7c9b4f1 (diff)
downloadbcm5719-llvm-e60cb7d1be4aac850c69486cf69f0c5fe250e3af.tar.gz
bcm5719-llvm-e60cb7d1be4aac850c69486cf69f0c5fe250e3af.zip
[InstSimplify] insertelement V, undef, ? --> V
This was part of InstCombine, but it's better placed in InstSimplify. InstCombine also had an unreachable but weaker fold for insertelement with undef index, so that is deleted. llvm-svn: 361559
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index b71841a1607..6e421dcaa73 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4011,6 +4011,11 @@ Value *llvm::SimplifyInsertElementInst(Value *Vec, Value *Val, Value *Idx,
if (isa<UndefValue>(Idx))
return UndefValue::get(Vec->getType());
+ // Inserting an undef scalar? Assume it is the same value as the existing
+ // vector element.
+ if (isa<UndefValue>(Val))
+ return Vec;
+
return nullptr;
}
OpenPOWER on IntegriCloud