diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 78b4a2c6c9eb13f6009f1482d44dd2d902d5144c..6ead515114707a9727b455a8441e20ca9709170d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -758,6 +758,20 @@ Instruction *InstCombiner::visitInvokeInst(InvokeInst &II) {
   return visitCallSite(&II);
 }
 
+// Check if it is a visc call
+static bool isVISCCall(const ImmutableCallSite &CS) {
+  if (!CS.getInstruction()) {
+    // This is not a call site
+    return false;
+  }
+  if (const CallInst *call = dyn_cast<CallInst>(CS.getInstruction())) {
+    if(const Function *F = call->getCalledFunction()) {
+      return F->getName().startswith("__visc__");
+    }
+  }
+  return false;
+}
+
 /// isSafeToEliminateVarargsCast - If this cast does not affect the value
 /// passed through the varargs area, we can eliminate the use of the cast.
 static bool isSafeToEliminateVarargsCast(const CallSite CS,
@@ -767,6 +781,11 @@ static bool isSafeToEliminateVarargsCast(const CallSite CS,
   if (!CI->isLosslessCast())
     return false;
 
+  // If this is a visc dummy call, avoid mungling types. We need types for
+  // generating correct visc code.
+  if(isVISCCall(CS))
+    return false;
+
   // The size of ByVal arguments is derived from the type, so we
   // can't change to a type with a different size.  If the size were
   // passed explicitly we could avoid this check.
@@ -780,6 +799,7 @@ static bool isSafeToEliminateVarargsCast(const CallSite CS,
     return false;
   if (!TD || TD->getTypeAllocSize(SrcTy) != TD->getTypeAllocSize(DstTy))
     return false;
+
   return true;
 }
 
@@ -976,7 +996,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
 }
 
 // transformConstExprCastCall - If the callee is a constexpr cast of a function,
-// attempt to move the cast to the arguments of the call/invoke.
+// attempt to move the cast to the arg\numents of the call/invoke.
 //
 bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   Function *Callee =