[PATCH] Disable inlining between sanitized and non-sanitized functions

Chandler Carruth chandlerc at gmail.com
Wed Jul 31 05:12:12 PDT 2013


  Sorry this kept getting dropped. I'll try to stay on top of it. The mechanism you're using is fine, but we just need to re-locate the check into the cost analysis. See below.


================
Comment at: lib/Transforms/IPO/Inliner.cpp:293-299
@@ -277,1 +292,9 @@
+
+  if (!functionsHaveCompatibleAttributes(CS.getCaller(),
+                                         CS.getCalledFunction())) {
+    DEBUG(dbgs() << "    NOT Inlining: incompatible attributes"
+                 << ", Call: " << *CS.getInstruction() << "\n");
+    return false;
+  }
+
   Function *Caller = CS.getCaller();
----------------
Ugh. Doing this here makes it very expensive, because we don't short-circuit the inline cost computation even though we're never going to use it.

I think you'll need to model this the same way we do returns twice and other things that result in IC.isNever() being true -- handle it inside the inline cost computation so that as soon as we know the answer isn't "always" we can give the cheap answer "no" without computing full cost.


http://llvm-reviews.chandlerc.com/D1035



More information about the llvm-commits mailing list