summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-11-07 14:59:14 -0800
committerCraig Topper <craig.topper@intel.com>2019-11-07 15:14:13 -0800
commit6749dc3446671df05235d0a218c426a314ac33cd (patch)
tree79b4729bb26de8aba3a5352bd769103a7d81fced /llvm/lib
parent2f32da3da1d5c02e7d212d1036982ff547cf1c25 (diff)
downloadbcm5719-llvm-6749dc3446671df05235d0a218c426a314ac33cd.tar.gz
bcm5719-llvm-6749dc3446671df05235d0a218c426a314ac33cd.zip
[InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement
x86_mmx is conceptually a vector already. Don't introduce an extra conversion between it and scalar i64. I'm using VectorType::isValidElementType which checks for floating point, integer, and pointers to hopefully make this more readable than just blacklisting x86_mmx. Differential Revision: https://reviews.llvm.org/D69964
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 65aaef28d87..0390368c4bb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2359,7 +2359,8 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
}
if (VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
- if (DestVTy->getNumElements() == 1 && !SrcTy->isVectorTy()) {
+ if (DestVTy->getNumElements() == 1 &&
+ VectorType::isValidElementType(SrcTy)) {
Value *Elem = Builder.CreateBitCast(Src, DestVTy->getElementType());
return InsertElementInst::Create(UndefValue::get(DestTy), Elem,
Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
@@ -2391,7 +2392,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
if (SrcVTy->getNumElements() == 1) {
// If our destination is not a vector, then make this a straight
// scalar-scalar cast.
- if (!DestTy->isVectorTy()) {
+ if (VectorType::isValidElementType(DestTy)) {
Value *Elem =
Builder.CreateExtractElement(Src,
Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
OpenPOWER on IntegriCloud