[PATCH] D46752: [Analysis] Validate the return type of s(n)printf libcalls

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 08:00:59 PDT 2018


mstorsjo added inline comments.


================
Comment at: lib/Analysis/TargetLibraryInfo.cpp:696
+            FTy.getParamType(1)->isPointerTy() &&
+            FTy.getReturnType()->isIntegerTy());
   case LibFunc_snprintf:
----------------
spatel wrote:
> Is it possible to make this check stronger:
> FTy.getReturnType()->isIntegerTy(32) ?
I guess that'd be ok as well, although it would disqualify any ILP64 platform. But I guess that's just a theoretical concern, given the number of ILP64 platforms.


================
Comment at: test/Transforms/InstCombine/sprintf-void.ll:13
+define void @test_simplify1(i8* %dst) {
+; CHECK-LABEL: @test_simplify1(
+  %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
----------------
spatel wrote:
> I always make this suggestion for instcombine tests: it's better to use the script at utils/update_test_checks.py to auto-generate the CHECK lines than to manually write them.
Ok, will do.


https://reviews.llvm.org/D46752





More information about the llvm-commits mailing list