[llvm-commits] [llvm] r51207 - /llvm/trunk/lib/Transforms/IPO/PruneEH.cpp

Duncan Sands baldrick at free.fr
Fri May 16 15:15:45 PDT 2008


Hi Dale,

> -    if (F == 0) {
> +    if (F == 0 || (F->hasWeakLinkage() && !F->doesNotThrow())) {
>        SCCMightUnwind = true;
>        SCCMightReturn = true;
>      } else if (F->isDeclaration()) {

this is pessimistic for functions that have the noreturn attribute
but not the nounwind attribute.  In fact the noreturn and nounwind
cases are exactly analogous.  How about the following instead:

    if (F == 0) {
      SCCMightUnwind = true;
      SCCMightReturn = true;
    } else if (F->isDeclaration() || F->hasWeakLinkage()) {
      SCCMightUnwind |= !F->doesNotThrow();
      SCCMightReturn |= !F->doesNotReturn();
    } else {

Ciao,

Duncan.

PS: Mightn't there be a similar problem with any IPO analysis or
transform that looks at bodies of functions?  Deductions made
from a body with weak linkage would be wrong...  I'm thinking of
Andersen's for example, but there might be many others...



More information about the llvm-commits mailing list