[PATCH] D12979: Avoid inlining in exception handling context

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 13:54:50 PDT 2015


junbuml added inline comments.

================
Comment at: lib/Transforms/IPO/PruneEH.cpp:362
@@ +361,3 @@
+  // call void @__cxa_throw(i8* %exception, .. )
+  for (User *FnU : FnThrowE->users()) {
+    auto *ThrowCall = dyn_cast<CallInst>(FnU);
----------------
hfinkel wrote:
> junbuml wrote:
> > hfinkel wrote:
> > > Why are you looking for users of __cxa_throw? Can we make the assumption that all user of __cxa_allocate_exception are essentially cold, and just look for the users of return values of that function?
> > > 
> > I'm trying to find all actual calls for __cxa_throw() by looking at the users of FnThrowE where an exception is thrown. 
> > 
> > Here, I specifically check the exception allocated to be thrown (__cxa_throw()) in throw statement, which should be cold unless the program logic highly rely on throw statement.
> > 
> > When a exception handling class is created in throw statement, 
> > the constructor must take the exception used in __cxa_throw() as its first parameter.
> > 
> > Please correct me if I miss something.
> > 
> I understand what you're doing, but my question is this: Is the call to __cxa_allocate_exception itself cold? If so, perhaps that's all we need to find. Maybe looking for the __cxa_throw calls is an unnecessary complication.
> 
I believe __cxa_allocate_exception() itself must be cold in almost all normal c++ program. But, I just wanted to make sure the exception allocated is actually used for throwing. If checking __cxa_throw() doesn't make it too complicated, I believe there is no harm with it. I can also leave FIXME about it.  Please let me know your thought!


http://reviews.llvm.org/D12979





More information about the llvm-commits mailing list