This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Fill in some more cases in `isKnownNeverZero`
ClosedPublic

Authored by goldstein.w.n on Apr 25 2023, 2:27 PM.

Details

Summary

This mostly copies cases that already exist in ValueTracking, although
it skips the more complex ones. Those can be filled in as needed.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Apr 25 2023, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 2:27 PM
goldstein.w.n requested review of this revision.Apr 25 2023, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 2:27 PM
craig.topper added inline comments.Apr 25 2023, 2:37 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5074–5117

I assume we checked operand 1 first to favor the cheap case of a non-zero constant right hand side.

craig.topper added inline comments.Apr 25 2023, 2:39 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5120

return after break?

5155

too many blank lines

5158

I don't think curly braces are needed here

5175

Or here

goldstein.w.n marked 5 inline comments as done.

Swap operand order. Fix some style nits

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5074–5117

Makes sense, updated that everywhere else.

Are we really hitting all these cases? We should really ensure we have test coverage for them all.

Are we really hitting all these cases? We should really ensure we have test coverage for them all.

Certainly not all of them. But fair point, will add tests.

Rebase with tests

Are we really hitting all these cases? We should really ensure we have test coverage for them all.

Added tests at D149299. Is there a better way to isolate/test DAGComber codes?

RKSimon added inline comments.May 13 2023, 3:28 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5089

This looks like a bad merge?

goldstein.w.n added inline comments.May 13 2023, 10:10 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5089

hmm?

RKSimon added inline comments.May 17 2023, 6:39 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5089

Sorry, I think I was miscounting brackets :)

goldstein.w.n added inline comments.May 18 2023, 9:57 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
5089

You where right!

Fix broken parens

ping. Dropped the assosiated setcc patch, but would like to get this through as an improvement to the helper as is.

RKSimon accepted this revision.Jul 10 2023, 2:57 AM

LGTM

This revision is now accepted and ready to land.Jul 10 2023, 2:57 AM
This revision was landed with ongoing or failed builds.Jul 12 2023, 3:18 PM
This revision was automatically updated to reflect the committed changes.