[PATCH] D130494: [InstCombine] Adjust snprintf folding of constant strings (PR #56598)

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 09:01:10 PDT 2022


majnemer added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:2846
     // %% -> % in the future if we cared.
-    if (FormatStr.contains('%'))
-      return nullptr; // we found a format specifier, bail out.
+    if (FormatStr.contains('%') || N > (uint64_t)maxIntN(32))
+      // Bail if the format string contains a formatting directive or
----------------
Does this do the right thing for targets whose INT_MAX is 16-bit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130494/new/

https://reviews.llvm.org/D130494



More information about the llvm-commits mailing list