This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Do not manifest noundef for dead positions
ClosedPublic

Authored by okura on Aug 25 2020, 11:54 AM.

Details

Summary

Even if noundef is deduced for a position, we should not manifest it when the position is dead.
This is because the associated values with dead positions are replaced with undef values by AAIsDead.

Diff Detail

Event Timeline

okura created this revision.Aug 25 2020, 11:54 AM
Herald added a reviewer: homerdin. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
okura requested review of this revision.Aug 25 2020, 11:54 AM
jdoerfert accepted this revision.Aug 25 2020, 2:08 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
7814

I'm not sure this should not be a false.

This revision is now accepted and ready to land.Aug 25 2020, 2:08 PM
sstefan1 added a comment.EditedAug 25 2020, 2:12 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Maybe this can be tested if we actually address the TODO for AANoUndef in AAUB? I think with that, this can be caught in module pass?

Just a suggestion.

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Maybe this can be tested if we actually address the TODO for AANoUndef in AAUB? I think with that, this can be caught in module pass?

Just a suggestion.

Right. That should work.

okura added a comment.Aug 25 2020, 2:42 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Sorry, I was wrong. CheckBBLivenessOnly should be false because if it is true we cannot catch the assumed liveness of e.g. returned position.
When I changed it to true, a new AAIsDead was registered in manifestation, and segfault happened. So I register them in initialize.
Some tests are affected by this change.

okura updated this revision to Diff 287781.Aug 25 2020, 2:44 PM
  • change CheckBBLivenessOnly to true
  • add affected tests
  • add new tests

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Sorry, I was wrong. CheckBBLivenessOnly should be false because if it is true we cannot catch the assumed liveness of e.g. returned position.
When I changed it to true, a new AAIsDead was registered in manifestation, and segfault happened. So I register them in initialize.

Don't do that but query them in the update instead.

okura added a comment.Aug 25 2020, 3:32 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Sorry, I was wrong. CheckBBLivenessOnly should be false because if it is true we cannot catch the assumed liveness of e.g. returned position.
When I changed it to true, a new AAIsDead was registered in manifestation, and segfault happened. So I register them in initialize.

Don't do that but query them in the update instead.

I have difficulty in doing that because segfault happens when a fixpoint is indicated in initialize and updateImpl is not called even once.

jdoerfert added a comment.EditedAug 25 2020, 3:33 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Sorry, I was wrong. CheckBBLivenessOnly should be false because if it is true we cannot catch the assumed liveness of e.g. returned position.
When I changed it to true, a new AAIsDead was registered in manifestation, and segfault happened. So I register them in initialize.

Don't do that but query them in the update instead.

I have difficulty in doing that because segfault happens when a fixpoint is indicated in initialize and updateImpl is not called even once.

TBH, I think we need to remove the assertion that you see (it should not be a segfault). And replace it with code that causes a pessimistic fixpoint for all attributes created after we are done with the update stage. They can initialize but that is it.

okura added a comment.EditedAug 25 2020, 3:44 PM

LGTM, one minor note. The test will be part of the module slice patch, I'm fairly certain this cannot be tested right now but it makes sense.

Sorry, I was wrong. CheckBBLivenessOnly should be false because if it is true we cannot catch the assumed liveness of e.g. returned position.
When I changed it to true, a new AAIsDead was registered in manifestation, and segfault happened. So I register them in initialize.

Don't do that but query them in the update instead.

I have difficulty in doing that because segfault happens when a fixpoint is indicated in initialize and updateImpl is not called even once.

TBH, I think we need to remove the assertion that you see (it should not be a segfault). And replace it with code that causes a pessimistic fixpoint for all attributes created after we are done with the update stage. They can initialize but that is it.

Yes, it was assertion failure. I used a wrong term, sorry for the confusion.
I agree to remove the assertion. Can I work on that?

okura retitled this revision from [Attributor][FIX] Do not deduce noundef for dead positions to [Attributor] Do not manifest noundef for dead positions.Aug 26 2020, 3:17 AM
okura edited the summary of this revision. (Show Details)

Are you going to move the AAIsDead query to the update?

okura added a comment.Aug 26 2020, 7:14 AM

Are you going to move the AAIsDead query to the update?

No, I'm going to allow to query (initialize) new AA in the manifestation stage. That will save us from querying AAIsDead before the manifestation stage.

okura added a comment.Aug 26 2020, 9:13 AM

Are you going to move the AAIsDead query to the update?

No, I'm going to allow to query (initialize) new AA in the manifestation stage. That will save us from querying AAIsDead before the manifestation stage.

I have uploaded a new patch for allowing to query AA in manifest . D86635

okura updated this revision to Diff 288442.Aug 27 2020, 1:28 PM

Delete AAIsDead query before manifestation because other patches (D86635, D86734) make it possible to query new AAs in manifest.

This revision was automatically updated to reflect the committed changes.