Index: lib/Transforms/InstCombine/InstCombineCasts.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -221,9 +221,25 @@
   }
   default:
     // TODO: Can handle more cases here.
-    llvm_unreachable("Unreachable!");
+    // This is not a recognized instruction. We need an explicit cast here.
+    // Currently we support this only when truncating expression type.
+    assert(CastInst::castIsValid(Instruction::Trunc, I, Ty) &&
+           "can not insert explicit cast");
+    assert(I->hasOneUse() &&
+           "can not truncate branching expression trees");
+
+    // Create truncate from "I" type to the Ty
+    Instruction *Trunc = CastInst::CreateTruncOrBitCast(I, Ty);
+    Trunc->setName(I->getName() + ".truncated");
+
+    // Insert new truncate after "I"
+    Instruction *NextI = I->getNextNode();
+    assert(NextI != I->getParent()->end() &&
+           "can not insert explicit truncate");
+    return InsertNewInstBefore(Trunc, *NextI);
   }
 
+  assert(Res && "failed to evaluate instruction in different type");
   Res->takeName(I);
   return InsertNewInstWith(Res, *I);
 }