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

Dale Johannesen dalej at apple.com
Fri May 16 16:02:04 PDT 2008


On May 16, 2008, at 3:15 PM, Duncan Sands wrote:

> 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 {

Looks reasonable, will check it out.

> 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...

Indeed there might.  I haven't done a full audio, fixing things as  
they show up...





More information about the llvm-commits mailing list