[llvm] r260949 - [Hexagon] Hoist nonnull assert up.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 01:53:47 PST 2016
Author: d0k
Date: Tue Feb 16 03:53:47 2016
New Revision: 260949
URL: http://llvm.org/viewvc/llvm-project?rev=260949&view=rev
Log:
[Hexagon] Hoist nonnull assert up.
Once a pointer is turned into a reference it cannot be nullptr, clang
rightfully warns about this assert being a tautology. Put the assert
before the reference is created.
Modified:
llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
Modified: llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp?rev=260949&r1=260948&r2=260949&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp Tue Feb 16 03:53:47 2016
@@ -592,7 +592,6 @@ public:
static std::unique_ptr<HexagonOperand> CreateImm(const MCExpr *Val, SMLoc S,
SMLoc E) {
- assert(&HexagonMCInstrInfo::getExpr(*Val) != nullptr);
HexagonOperand *Op = new HexagonOperand(Immediate);
Op->Imm.Val = Val;
Op->Imm.MustExtend = false;
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp?rev=260949&r1=260948&r2=260949&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp Tue Feb 16 03:53:47 2016
@@ -193,6 +193,7 @@ MCInstrDesc const &HexagonMCInstrInfo::g
MCExpr const &HexagonMCInstrInfo::getExpr(MCExpr const &Expr) {
HexagonMCExpr const &HExpr = *llvm::cast<HexagonMCExpr>(&Expr);
+ assert(HExpr.getExpr());
return *HExpr.getExpr();
}
More information about the llvm-commits
mailing list