[llvm] 7081e59 - [MC] Remove an unneeded comparison on cast result. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 17:46:50 PST 2023
Author: Fangrui Song
Date: 2023-02-15T17:46:45-08:00
New Revision: 7081e59dd12a92ba00327ba6268319d6f98bd4c3
URL: https://github.com/llvm/llvm-project/commit/7081e59dd12a92ba00327ba6268319d6f98bd4c3
DIFF: https://github.com/llvm/llvm-project/commit/7081e59dd12a92ba00327ba6268319d6f98bd4c3.diff
LOG: [MC] Remove an unneeded comparison on cast result. NFC
Added:
Modified:
llvm/lib/MC/MCExpr.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 45a3d938257a..04682fdc7ece 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -885,18 +885,19 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
!ABE->getRHS()->evaluateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
Addrs, InSet)) {
// Check if both are Target Expressions, see if we can compare them.
- if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS()))
- if (const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS())) {
- switch (ABE->getOpcode()) {
- case MCBinaryExpr::EQ:
- Res = MCValue::get((L->isEqualTo(R)) ? -1 : 0);
- return true;
- case MCBinaryExpr::NE:
- Res = MCValue::get((R->isEqualTo(R)) ? 0 : -1);
- return true;
- default: break;
- }
+ if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS())) {
+ const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS());
+ switch (ABE->getOpcode()) {
+ case MCBinaryExpr::EQ:
+ Res = MCValue::get(L->isEqualTo(R) ? -1 : 0);
+ return true;
+ case MCBinaryExpr::NE:
+ Res = MCValue::get(R->isEqualTo(R) ? 0 : -1);
+ return true;
+ default:
+ break;
}
+ }
return false;
}
More information about the llvm-commits
mailing list