This is an archive of the discontinued LLVM Phabricator instance.

PruneEH pass incorrectly reports that a change was made
ClosedPublic

Authored by apilipenko on Oct 26 2015, 4:26 PM.

Details

Summary

PruneEH incorrectly sets MadeChange while adding function attributes. To determine whether a change was made it compares function attributes set with new attributes set. Function attributes set might include new attributes set as well as some other attributes. In this case MadeChange is set, however no change is made.

Diff Detail

Event Timeline

apilipenko updated this revision to Diff 38478.Oct 26 2015, 4:26 PM
apilipenko retitled this revision from to PruneEH pass incorrectly reports that a change was made.
apilipenko updated this object.
apilipenko added reviewers: reames, sanjoy.
apilipenko added a subscriber: llvm-commits.

Test case?

As far as I can see this value is not reported or logged anywhere, so I can't see an easy way to test it. I come across this issue while running PruneEH in a fixed point iteration loop.

reames requested changes to this revision.Oct 28 2015, 9:20 PM
reames edited edge metadata.
reames added inline comments.
lib/Transforms/IPO/PruneEH.cpp
158

I think it would be much clearer to restructure this code as:
if (!SCCMightUnwind &&

 !F->hasFnAttribute(Attribute::NoUnwind)) {
F->addFnAttr(Attribute::NoUnwind);
MadeChange = true;

}
...

This revision now requires changes to proceed.Oct 28 2015, 9:20 PM
apilipenko updated this revision to Diff 38951.Nov 2 2015, 11:28 AM
apilipenko edited edge metadata.
reames accepted this revision.Nov 3 2015, 3:19 PM
reames edited edge metadata.

LGTM

This revision is now accepted and ready to land.Nov 3 2015, 3:19 PM
This revision was automatically updated to reflect the committed changes.