aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/ExprTypeConvert.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-09 20:25:21 +0000
committerChris Lattner <sabre@nondot.org>2002-09-09 20:25:21 +0000
commit871d2ce6905448f53cb9acc3eb641899b166ce22 (patch)
tree0ee4f0c2ffe41f85886fa9947d5767d30b15f0f6 /lib/Transforms/ExprTypeConvert.cpp
parentcaa5d13cda3902b5c120089c6b3866eb294ab4eb (diff)
Disallow creation of pointer typed shift instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/ExprTypeConvert.cpp')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 01c8d6f354..0a42f21801 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -1,4 +1,4 @@
-//===- ExprTypeConvert.cpp - Code to change an LLVM Expr Type ---------------=//
+//===- ExprTypeConvert.cpp - Code to change an LLVM Expr Type -------------===//
//
// This file implements the part of level raising that checks to see if it is
// possible to coerce an entire expression tree into a different type. If
@@ -193,9 +193,11 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty,
return false;
break;
case Instruction::Shr:
+ if (!Ty->isInteger()) return false;
if (Ty->isSigned() != V->getType()->isSigned()) return false;
// FALL THROUGH
case Instruction::Shl:
+ if (!Ty->isInteger()) return false;
if (!ExpressionConvertableToType(I->getOperand(0), Ty, CTMap))
return false;
break;
@@ -633,6 +635,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
// FALL THROUGH
case Instruction::Shl:
assert(I->getOperand(0) == V);
+ if (!Ty->isInteger()) return false;
return ValueConvertableToType(I, Ty, CTMap);
case Instruction::Free: