Skip to content

Commit 76cc949

Browse files
committed
Clean come dead code
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)); } ``` 4. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663 5. 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. Reviewed By: skan Differential Revision: https://reviews.llvm.org/D148610
1 parent 8e58b79 commit 76cc949

File tree

5 files changed

+2
-23
lines changed

5 files changed

+2
-23
lines changed

llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
920920
}
921921

922922
assert(AntiDepReg != 0);
923-
if (AntiDepReg == 0) continue;
924923

925924
// Determine AntiDepReg's register group.
926925
const unsigned GroupIndex = State->GetGroup(AntiDepReg);

llvm/lib/CodeGen/IfConversion.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ static cl::opt<bool> DisableTriangleR("disable-ifcvt-triangle-rev",
7171
cl::init(false), cl::Hidden);
7272
static cl::opt<bool> DisableTriangleF("disable-ifcvt-triangle-false",
7373
cl::init(false), cl::Hidden);
74-
static cl::opt<bool> DisableTriangleFR("disable-ifcvt-triangle-false-rev",
75-
cl::init(false), cl::Hidden);
7674
static cl::opt<bool> DisableDiamond("disable-ifcvt-diamond",
7775
cl::init(false), cl::Hidden);
7876
static cl::opt<bool> DisableForkedDiamond("disable-ifcvt-forked-diamond",
@@ -532,7 +530,6 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
532530
if (DisableTriangle && !isFalse && !isRev) break;
533531
if (DisableTriangleR && !isFalse && isRev) break;
534532
if (DisableTriangleF && isFalse && !isRev) break;
535-
if (DisableTriangleFR && isFalse && isRev) break;
536533
LLVM_DEBUG(dbgs() << "Ifcvt (Triangle");
537534
if (isFalse)
538535
LLVM_DEBUG(dbgs() << " false");

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3934,11 +3934,6 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
39343934
// If the relocation model supports it, consider symbol offsets.
39353935
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(N0))
39363936
if (!LegalOperations && TLI.isOffsetFoldingLegal(GA)) {
3937-
// fold (sub Sym, c) -> Sym-c
3938-
if (N1C && GA->getOpcode() == ISD::GlobalAddress)
3939-
return DAG.getGlobalAddress(GA->getGlobal(), SDLoc(N1C), VT,
3940-
GA->getOffset() -
3941-
(uint64_t)N1C->getSExtValue());
39423937
// fold (sub Sym+c1, Sym+c2) -> c1-c2
39433938
if (GlobalAddressSDNode *GB = dyn_cast<GlobalAddressSDNode>(N1))
39443939
if (GA->getGlobal() == GB->getGlobal())

llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ void ScheduleDAGSDNodes::computeOperandLatency(SDNode *Def, SDNode *Use,
667667
// This copy is a liveout value. It is likely coalesced, so reduce the
668668
// latency so not to penalize the def.
669669
// FIXME: need target specific adjustment here?
670-
Latency = (Latency > 1) ? Latency - 1 : 1;
670+
Latency = Latency - 1;
671671
}
672672
if (Latency >= 0)
673673
dep.setLatency(Latency);

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,19 +1618,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
16181618
// Parse symbol variant.
16191619
std::pair<StringRef, StringRef> Split;
16201620
if (!MAI.useParensForSymbolVariant()) {
1621-
if (FirstTokenKind == AsmToken::String) {
1622-
if (Lexer.is(AsmToken::At)) {
1623-
Lex(); // eat @
1624-
SMLoc AtLoc = getLexer().getLoc();
1625-
StringRef VName;
1626-
if (parseIdentifier(VName))
1627-
return Error(AtLoc, "expected symbol variant after '@'");
1628-
1629-
Split = std::make_pair(Identifier, VName);
1630-
}
1631-
} else {
1632-
Split = Identifier.split('@');
1633-
}
1621+
Split = Identifier.split('@');
16341622
} else if (Lexer.is(AsmToken::LParen)) {
16351623
Lex(); // eat '('.
16361624
StringRef VName;

0 commit comments

Comments
 (0)