Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44286 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index cc6cde2..1508fd0 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1470,6 +1470,9 @@
 /// Analyze the expression.
 ///
 SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
+  if (!isa<IntegerType>(V->getType()))
+    return SE.getUnknown(V);
+    
   if (Instruction *I = dyn_cast<Instruction>(V)) {
     switch (I->getOpcode()) {
     case Instruction::Add:
@@ -2076,6 +2079,11 @@
           if (Constant *C = dyn_cast<Constant>(Op)) {
             Operands.push_back(C);
           } else {
+            // If any of the operands is non-constant and if they are
+            // non-integer, don't even try to analyze them with scev techniques.
+            if (!isa<IntegerType>(Op->getType()))
+              return V;
+              
             SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
             if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV))
               Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(),