[llvm] dfa9716 - [GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 19 11:44:17 PST 2022
Author: Simon Pilgrim
Date: 2022-02-19T19:43:53Z
New Revision: dfa9716dd7a63943ba887bc002d726bffc3490ef
URL: https://github.com/llvm/llvm-project/commit/dfa9716dd7a63943ba887bc002d726bffc3490ef
DIFF: https://github.com/llvm/llvm-project/commit/dfa9716dd7a63943ba887bc002d726bffc3490ef.diff
LOG: [GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.
Break the if-else chain as every block returns, and remove the return at the end of the function as the else block means this was never hit
Added:
Modified:
llvm/utils/TableGen/GICombinerEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/GICombinerEmitter.cpp b/llvm/utils/TableGen/GICombinerEmitter.cpp
index 0dea1ef00e4bd..3ab44ae528449 100644
--- a/llvm/utils/TableGen/GICombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GICombinerEmitter.cpp
@@ -939,15 +939,14 @@ void GICombinerEmitter::run(raw_ostream &OS) {
<< " report_fatal_error(\"Beginning of range should be before "
"end of range\");\n"
<< " return {{*First, *Last + 1}};\n"
- << " } else if (RangePair.first == \"*\") {\n"
+ << " }\n"
+ << " if (RangePair.first == \"*\") {\n"
<< " return {{0, " << Rules.size() << "}};\n"
- << " } else {\n"
- << " const auto I = getRuleIdxForIdentifier(RangePair.first);\n"
- << " if (!I.hasValue())\n"
- << " return None;\n"
- << " return {{*I, *I + 1}};\n"
<< " }\n"
- << " return None;\n"
+ << " const auto I = getRuleIdxForIdentifier(RangePair.first);\n"
+ << " if (!I.hasValue())\n"
+ << " return None;\n"
+ << " return {{*I, *I + 1}};\n"
<< "}\n\n";
for (bool Enabled : {true, false}) {
More information about the llvm-commits
mailing list