Add missing newlines at EOF (for clang++).
[oota-llvm.git] / lib / Transforms / Scalar / SimplifyLibCalls.cpp
index 89602985c871faaec4d47bf9097ff2b5cabf92b1..192bcbd6c2908e1e44d773ff24cba85f529b245a 100644 (file)
@@ -949,7 +949,7 @@ struct StrStrOpt : public LibCallOptimization {
 
     // fold strstr(x, x) -> x.
     if (CI->getOperand(1) == CI->getOperand(2))
-      return CI->getOperand(1);
+      return B.CreateBitCast(CI->getOperand(1), CI->getType());
     
     // See if either input string is a constant string.
     std::string SearchStr, ToFindStr;
@@ -967,7 +967,7 @@ struct StrStrOpt : public LibCallOptimization {
       if (Offset == std::string::npos) // strstr("foo", "bar") -> null
         return Constant::getNullValue(CI->getType());
 
-      // strstr("abcd", "bc") -> gep((char*)"abcd", 2)
+      // strstr("abcd", "bc") -> gep((char*)"abcd", 1)
       Value *Result = CastToCStr(CI->getOperand(1), B);
       Result = B.CreateConstInBoundsGEP1_64(Result, Offset, "strstr");
       return B.CreateBitCast(Result, CI->getType());