[PATCH] D12979: Avoid inlining in exception handling context

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 21:33:27 PDT 2015


hfinkel added inline comments.

================
Comment at: lib/Transforms/IPO/PruneEH.cpp:203
@@ +202,3 @@
+        MarkColdInEHR = true;
+        break;
+      }
----------------
junbuml wrote:
> hfinkel wrote:
> > Why do you 'break;' here? If you do that, you'll only visit the first function in each call graph.
> > 
> > I think you want to have:
> > 
> >   if (!MarkColdInEHR && SCCMightUnwind) {
> >     MarkColdInEHR = true;
> >      for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
> >        Function *F = (*I)->getFunction();
> >        if (!F)
> >          continue;
> > 
> >        AddColdForCSInEH(F);
> >     }
> >   }
> > 
> As I comment above, AddColdForCSInEH() does not need to be performed multiple times for each function. Since it handle all CallSites for __cxa_throw() in a module, it should be called only once per module. That's also why I have MarkColdInEHR . 
OIC, you don't really want to iterate over the call graph here at all; you're just trying to get the first function, any function, so that you can call getParent() to get the module.

Don't do that, just call CG.getModule().


http://reviews.llvm.org/D12979





More information about the llvm-commits mailing list