[PATCH] D18423: [SimplifyLibCalls] Transform printf("%s", "a") into putchar('a')

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 08:48:49 PDT 2016


davide added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1852
@@ +1851,3 @@
+      return Res;
+    return B.CreateIntCast(Res, CI->getType(), true);
+  }
----------------
spatel wrote:
> Ah, I didn't look far enough ahead to see that guard.
> But if we know that CI->use_empty() is always true at this point, then why are we checking it here? If we want to be safe, we could assert that condition, but I don't think that's necessary given that the guard is just a few lines up in the code. Unless I've misunderstood, we should make that change in all of the related printf transforms too.
Good idea, maybe in the next commit I can do a global sweep?


http://reviews.llvm.org/D18423





More information about the llvm-commits mailing list