[llvm] r260949 - [Hexagon] Hoist nonnull assert up.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 17:27:52 PST 2016
On Tue, Feb 16, 2016 at 1:53 AM, Benjamin Kramer via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> 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);
>
Speaking of weird null/reference things, perhaps we can drop the &/* in
this line ^ since llvm::cast supports casting refs?
> + assert(HExpr.getExpr());
> return *HExpr.getExpr();
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160216/9216f518/attachment.html>
More information about the llvm-commits
mailing list