[PATCH] D45418: [SimplifyLibcalls] Atoi, strtol replacements
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 10:59:03 PDT 2018
lebedev.ri added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1697
+ if (ConstantInt *CInt = dyn_cast<ConstantInt>(CI->getArgOperand(2)))
+ return ConstantInt::get(CI->getType(), strtol(Str.str().c_str(), nullptr,
+ CInt->getSExtValue()));
----------------
`base` is `i32`, but `strtol` returns `long int` (`i64`?), so i don't think using `CI->getType()` is correct.
================
Comment at: test/Transforms/InstCombine/str-int.ll:5
+ at .str = private unnamed_addr constant [3 x i8] c"12\00", align 1
+ at .str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
+
----------------
So i suppose this needs a test with larger-than-32bit-integer.
https://reviews.llvm.org/D45418
More information about the llvm-commits
mailing list