This is an archive of the discontinued LLVM Phabricator instance.

Clean come dead code
ClosedPublic

Authored by XinWang10 on Apr 18 2023, 12:53 AM.

Details

Summary

These codes deleted are dead code, we never go into it.

  1. In AggressiveAntiDepBreaker.cpp, have assert AntiDepReg != 0.
  2. IfConversion.cpp, Kind can only be one unique value, so isFalse && isRev can never be true.
  3. DAGCombiner.cpp, at line 3675, we have considered the condition like
// fold (sub x, c) -> (add x, -c)
if (N1C) {
  return DAG.getNode(ISD::ADD, DL, VT, N0,
                     DAG.getConstant(-N1C->getAPIntValue(), DL, VT));
}
  1. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663
  2. MasmParser.cpp, code exists in a switch-case block which decided by the value FirstTokenKind, at line 1621, FirstTokenKind could only be one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier.

Diff Detail

Event Timeline

XinWang10 created this revision.Apr 18 2023, 12:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 12:53 AM
XinWang10 requested review of this revision.Apr 18 2023, 12:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 12:53 AM
XinWang10 edited the summary of this revision. (Show Details)Apr 18 2023, 1:02 AM
skan added inline comments.Apr 18 2023, 1:12 AM
llvm/lib/CodeGen/IfConversion.cpp
535

Should we add an assertion !(isFalse && isRev) here?

llvm/lib/MC/MCParser/MasmParser.cpp
1620

Assert FirstTokenKind != AsmToken::String?

craig.topper added inline comments.
llvm/lib/CodeGen/IfConversion.cpp
535

Does this mean DisableTriangleFR is also dead?

XinWang10 added inline comments.Apr 18 2023, 1:31 AM
llvm/lib/CodeGen/IfConversion.cpp
535

No, DisableTriangleFR is a option specified by user. Perhaps we'd better just remove isFalse && isRev.

535

add an assertion !(isFalse && isRev), I think it doesn't make sense here, just add another dead code?

skan added inline comments.Apr 18 2023, 1:40 AM
llvm/lib/CodeGen/IfConversion.cpp
535

I believe assertion is ignored for dead code. But I agree with you, the assertion is useless here b/c the definitions of isRev and 'isFalse' are nearby。

skan added a comment.Apr 18 2023, 1:41 AM

Update the summary? It's not formatted.

XinWang10 edited the summary of this revision. (Show Details)Apr 18 2023, 1:42 AM
XinWang10 edited the summary of this revision. (Show Details)
XinWang10 edited the summary of this revision. (Show Details)
XinWang10 edited the summary of this revision. (Show Details)Apr 18 2023, 1:45 AM
XinWang10 edited the summary of this revision. (Show Details)Apr 18 2023, 1:49 AM
XinWang10 edited the summary of this revision. (Show Details)
XinWang10 updated this revision to Diff 514588.Apr 18 2023, 3:14 AM
  • update
llvm/lib/CodeGen/IfConversion.cpp
535

Does this mean DisableTriangleFR is also dead?

I get your point now, I try to search for it, seems it also die.

XinWang10 added inline comments.Apr 18 2023, 6:53 PM
llvm/lib/MC/MCParser/MasmParser.cpp
1620

It's not necessary, FirstTokenKind should always be one of one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier and never be AsmToken::String. can refer to line 1580

skan accepted this revision.Apr 18 2023, 6:58 PM

LGTM

This revision is now accepted and ready to land.Apr 18 2023, 6:58 PM
This revision was landed with ongoing or failed builds.Apr 23 2023, 5:47 PM
This revision was automatically updated to reflect the committed changes.