[PATCH] D33737: [InstSimplify] Don't constant fold or DCE calls that are marked nobuiltin

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 16:22:26 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Utils/Evaluator.cpp:363
+      // Cannot evaluate nobuiltin functions.
+      if (CS.isNoBuiltin()) {
+        DEBUG(dbgs() << "Can not evaluate nobuiltin call\n");
----------------
andrew.w.kaylor wrote:
> efriedma wrote:
> > This isn't doing what you want: we don't call ConstantFoldCall on all paths.
> My reasoning is that if the call is marked as nobuiltin then we can't make any assumptions about what it does.  To be honest though, I wasn't sure about this function.
> 
> Is this used by LLDB and similar clients for live code evaluation?
If we have a definition where "isDefinitionExact()" is true, then we know the function does by examining the definition, so nobuiltin isn't relevant. (Actually, looking more closely, I think we're missing the "isDefinitionExact()" check.)

This isn't really a general-purpose IR interpreter; it's used by GlobalOpt to simplify C++ global initialization.


Repository:
  rL LLVM

https://reviews.llvm.org/D33737





More information about the llvm-commits mailing list