[PATCH] D18634: Don't IPO over functions that can be de-refined

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 19:04:38 PDT 2016


chandlerc added a comment.

Thinking a bit more about this, but this is looking pretty nice. Will do a final pass shortly.


================
Comment at: include/llvm/IR/GlobalValue.h:143-151
@@ +142,11 @@
+  bool mayBeOverridden() const {
+    switch (getLinkage()) {
+    case WeakAnyLinkage:
+    case LinkOnceAnyLinkage:
+    case CommonLinkage:
+    case ExternalWeakLinkage:
+      return true;
+
+    default:
+      return false;
+    }
----------------
Do we want to invert this (and above) so that the default is conservatively correct if we add a new linkage?

================
Comment at: lib/Analysis/GlobalsModRef.cpp:475
@@ +474,3 @@
+    if (!SCC[0]->getFunction() || !SCC[0]->getFunction()->isDefinitionExact()) {
+      // Calls externally or is derefinable - can't say anything useful. Remove
+      // any existing function records (may have been created when scanning
----------------
is derefinable -> is not an exact definition

================
Comment at: lib/Analysis/InlineCost.cpp:1483
@@ +1482,3 @@
+  // Note: inlining non-exact non-interposable fucntions is fine, since we know
+  // we have *a* correct implementation of the source level function
+  if (Callee->isInterposable() ||
----------------
Missing '.'


http://reviews.llvm.org/D18634





More information about the llvm-commits mailing list