This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] Avoid deleted SDNodes PromoteIntBinOp
ClosedPublic

Authored by niravd on Mar 20 2017, 12:21 PM.

Details

Summary

Reorder work in PromoteIntBinOp to prevent stale (deleted) nodes from
being used.

Fixes PR32340 and PR32345

Diff Detail

Repository
rL LLVM

Event Timeline

niravd created this revision.Mar 20 2017, 12:21 PM
niravd updated this revision to Diff 92632.EditedMar 22 2017, 7:08 AM

Catch missing case and add related test

niravd edited the summary of this revision. (Show Details)Mar 22 2017, 7:09 AM
niravd added a reviewer: RKSimon.
niravd updated this revision to Diff 92635.Mar 22 2017, 7:15 AM
niravd edited the summary of this revision. (Show Details)

Readd promotion failure check

RKSimon added inline comments.Mar 22 2017, 7:40 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1099 ↗(On Diff #92635)

What about cases where PromoteOperand returns SDValue()? Or where N0 == N1?

RKSimon added inline comments.Mar 22 2017, 7:44 AM
test/CodeGen/X86/pr32345.ll
1 ↗(On Diff #92635)

There are failures both on -mtriple=i686-unknown and -mtriple=x86_64-unknown (different assertions, same cause) - please can you test both?

niravd updated this revision to Diff 92660.Mar 22 2017, 10:51 AM
niravd marked 2 inline comments as done.

Fix failed promote case

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1099 ↗(On Diff #92635)

The failure of PromoteOperand is an issue (fixed in new patch). If N0 == N1 (or is a subexpression), the replacement would be invalid and will not happen.

The SDValue check needs to be added.

RKSimon added inline comments.Mar 24 2017, 4:31 AM
test/CodeGen/X86/pr32340.ll
2 ↗(On Diff #92660)

Please can you reduce and clean (strip metadata etc.) this test?

niravd updated this revision to Diff 92946.Mar 24 2017, 7:52 AM

Simplify/cleanup tests and add Sanity Filecheck

niravd marked an inline comment as done.Mar 24 2017, 7:52 AM
niravd updated this revision to Diff 93163.Mar 27 2017, 11:52 AM

Change guard to reflect actual deleted check.

RKSimon accepted this revision.Mar 28 2017, 7:56 AM

LGTM but if you can please strip the *.getNode() from the bool checks - they're not necessary

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1105 ↗(On Diff #93163)

No need to include the .getNode() for the bool test

This revision is now accepted and ready to land.Mar 28 2017, 7:56 AM
This revision was automatically updated to reflect the committed changes.