[llvm] 83d0db5 - Fix "expression is redundant [misc-redundant-expression]" warning (PR44768)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 13:25:12 PST 2020
Author: Simon Pilgrim
Date: 2020-02-04T21:24:21Z
New Revision: 83d0db59d6ffddfe57a1a1f1ccb2a8a18cc6c940
URL: https://github.com/llvm/llvm-project/commit/83d0db59d6ffddfe57a1a1f1ccb2a8a18cc6c940
DIFF: https://github.com/llvm/llvm-project/commit/83d0db59d6ffddfe57a1a1f1ccb2a8a18cc6c940.diff
LOG: Fix "expression is redundant [misc-redundant-expression]" warning (PR44768)
Be more specific that getOperandConstraint should return -1 or a uint8_t value
Added:
Modified:
llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
index 79f513778f8f..674db3fe1598 100644
--- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
+++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
@@ -119,8 +119,10 @@ Instruction::create(const MCInstrInfo &InstrInfo,
if (OpInfo.RegClass >= 0)
Operand.Tracker = &RATC.getRegisterClass(OpInfo.RegClass);
int TiedToIndex = Description->getOperandConstraint(OpIndex, MCOI::TIED_TO);
- assert(TiedToIndex == -1 ||
- TiedToIndex < std::numeric_limits<uint8_t>::max());
+ assert((TiedToIndex == -1 ||
+ (0 <= TiedToIndex &&
+ TiedToIndex < std::numeric_limits<uint8_t>::max())) &&
+ "Unknown Operand Constraint");
if (TiedToIndex >= 0)
Operand.TiedToIndex = TiedToIndex;
Operand.Info = &OpInfo;
More information about the llvm-commits
mailing list