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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 07:11:39 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/TargetLibraryInfo.cpp:696
+            FTy.getParamType(1)->isPointerTy() &&
+            FTy.getReturnType()->isIntegerTy());
   case LibFunc_snprintf:
----------------
Is it possible to make this check stronger:
FTy.getReturnType()->isIntegerTy(32) ?


================
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
----------------
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.


https://reviews.llvm.org/D46752





More information about the llvm-commits mailing list