This is an archive of the discontinued LLVM Phabricator instance.

[ TargetLowering, AMDGPU] Use the return value of UpdateNodeOperands();
ClosedPublic

Authored by msearles on Oct 2 2017, 9:57 AM.

Details

Summary

Use the return value of UpdateNodeOperands(); in some cases, UpdateNodeOperands() modifies the node in-place and using the return value isn’t strictly necessary. However, it does not necessarily modify the node, but may return a resultant node if it already exists in the DAG. See comments in UpdateNodeOperands(). In that case, the return value must be used to avoid such scenarios as an infinite loop (node is assumed to have been updated, so added back to the worklist, and re-processed; however, node hasn’t changed so it is once again passed to UpdateNodeOperands(), assumed modified, added back to worklist; cycle infinitely repeats).

Diff Detail

Event Timeline

msearles created this revision.Oct 2 2017, 9:57 AM
msearles retitled this revision from Use the return value of UpdateNodeOperands(); to [ TargetLowering, AMDGPU] Use the return value of UpdateNodeOperands(); .Oct 2 2017, 10:01 AM
msearles edited the summary of this revision. (Show Details)
arsenm added inline comments.Oct 2 2017, 10:29 AM
test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll
1

Does this actually work? I've never seen another test use ulimit or a sub shell. 5 seconds seems high also.

74

Run instnamer on this test

RKSimon added inline comments.Oct 2 2017, 10:45 AM
lib/Target/AMDGPU/SIISelLowering.cpp
6489
return DAG.UpdateNodeOperands(Node, Ops);
test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll
1

Does this work on windows builds?

16

You're not testing that foo() is empty - just that it includes s_endpgm

msearles updated this revision to Diff 117408.Oct 2 2017, 12:43 PM

Update per reviewer comments

msearles marked 5 inline comments as done.Oct 2 2017, 12:46 PM
msearles added inline comments.
test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll
1

Nope; will not work on Windows; test adjusted.

1

Yes, it works quite nicely on Linux; it will not work on Windows (thanks Simon) as ulimit is not available. I removed the ulimit. So, potentially, there may be a compiler regression that causes this to loop infinitely; however, I think that you could say that about any test.

16

Updated the comments within the test; the purpose of the test is to verify that code was generated, not specifically that foo() is empty.

74

Done.

msearles marked 2 inline comments as done.

Ping

RKSimon added inline comments.Oct 9 2017, 1:51 PM
test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll
1

Remove the brackets? Also, drop the prefix and use the default 'CHECK' ?

msearles updated this revision to Diff 118274.Oct 9 2017, 2:36 PM

Update test per reviewer comments.

msearles marked an inline comment as done.Oct 9 2017, 2:37 PM
msearles added inline comments.
test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll
1

Done and done.

RKSimon edited edge metadata.Oct 10 2017, 4:33 AM

Where did the code change go in the diff?

msearles updated this revision to Diff 118396.Oct 10 2017, 8:06 AM
msearles marked an inline comment as done.

Added correct diff file.

arsenm accepted this revision.Oct 16 2017, 2:43 PM

LGTM

This revision is now accepted and ready to land.Oct 16 2017, 2:43 PM
This revision was automatically updated to reflect the committed changes.