aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-12 01:19:22 +0000
committerChris Lattner <sabre@nondot.org>2010-07-12 01:19:22 +0000
commitdfd3626b477a416040fc4c08d5db3bb85d3500d8 (patch)
tree2a6744be2a9438878813ffb762cfabb302c84b8f /lib/VMCore/Instructions.cpp
parent5a30a8574cbcd3b385b1e8681c6a5c45856efb38 (diff)
downloadexternal_llvm-dfd3626b477a416040fc4c08d5db3bb85d3500d8.tar.gz
external_llvm-dfd3626b477a416040fc4c08d5db3bb85d3500d8.tar.bz2
external_llvm-dfd3626b477a416040fc4c08d5db3bb85d3500d8.zip
fix PR7311 by avoiding breaking casts when a bitcast from scalar->vector
is involved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index a32cb3c871..381b85faa4 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -2006,6 +2006,14 @@ unsigned CastInst::isEliminableCastPair(
{ 99,99,99,99,99,99,99,99,99,13,99,12 }, // IntToPtr |
{ 5, 5, 5, 6, 6, 5, 5, 6, 6,11, 5, 1 }, // BitCast -+
};
+
+ // If either of the casts are a bitcast from scalar to vector, disallow the
+ // merging.
+ if ((firstOp == Instruction::BitCast &&
+ isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
+ (secondOp == Instruction::BitCast &&
+ isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
+ return 0; // Disallowed
int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
[secondOp-Instruction::CastOpsBegin];