[llvm] r268057 - Fix NDEBUG build: variables used only in debug code causing compile error

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 15:54:03 PDT 2016


On Fri, Apr 29, 2016 at 9:14 AM, Krzysztof Parzyszek via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: kparzysz
> Date: Fri Apr 29 11:14:00 2016
> New Revision: 268057
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268057&view=rev
> Log:
> Fix NDEBUG build: variables used only in debug code causing compile error
>
> Modified:
>     llvm/trunk/lib/Target/Hexagon/HexagonOptAddrMode.cpp
>
> Modified: llvm/trunk/lib/Target/Hexagon/HexagonOptAddrMode.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonOptAddrMode.cpp?rev=268057&r1=268056&r2=268057&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/HexagonOptAddrMode.cpp (original)
> +++ llvm/trunk/lib/Target/Hexagon/HexagonOptAddrMode.cpp Fri Apr 29
> 11:14:00 2016
> @@ -147,6 +147,7 @@ MachineInstr *HexagonOptAddrMode::getRea
>      NodeAddr<StmtNode *> ReachingIA = RDN.Addr->getOwner(*DFG);
>      DEBUG(dbgs() << "\t\t\t[Def Node]: "
>                   << Print<NodeAddr<InstrNode *>>(ReachingIA, *DFG) <<
> "\n");
> +    (void)ReachingIA;
>

Could we just sink the variable into the DEBUG block (either remove the
variable entirely & just use the expression in the Print<> call - or
declare the variable inside the DEBUG block)

(same feedback for the last two instances in this file)


>      NodeId ReachedID = RDN.Addr->getReachedDef();
>      if (!ReachedID)
>        return ReachedDefMI;
> @@ -233,9 +234,10 @@ bool HexagonOptAddrMode::allValidCandida
>        DEBUG(dbgs() << "*** Multiple Reaching Defs found!!! *** \n");
>        for (auto DI : ReachingDefs) {
>          NodeAddr<UseNode *> DA = DFG->addr<UseNode *>(DI);
> -        NodeAddr<StmtNode *> tempIA = DA.Addr->getOwner(*DFG);
> +        NodeAddr<StmtNode *> TempIA = DA.Addr->getOwner(*DFG);
> +        (void)TempIA;
>          DEBUG(dbgs() << "\t\t[Reaching Def]: "
> -                     << Print<NodeAddr<InstrNode *>>(tempIA, *DFG) <<
> "\n");
> +                     << Print<NodeAddr<InstrNode *>>(TempIA, *DFG) <<
> "\n");
>        }
>

Perhaps this whole loop should be inside a DEBUG() block?


>        return false;
>      }
> @@ -253,9 +255,10 @@ void HexagonOptAddrMode::getAllRealUses(
>
>      for (auto UI : UseSet) {
>        NodeAddr<UseNode *> UA = DFG->addr<UseNode *>(UI);
> -      NodeAddr<StmtNode *> tempIA = UA.Addr->getOwner(*DFG);
> +      NodeAddr<StmtNode *> TempIA = UA.Addr->getOwner(*DFG);
> +      (void)TempIA;
>        DEBUG(dbgs() << "\t\t\t[Reached Use]: "
> -                   << Print<NodeAddr<InstrNode *>>(tempIA, *DFG) << "\n");
> +                   << Print<NodeAddr<InstrNode *>>(TempIA, *DFG) << "\n");
>
>        if (UA.Addr->getFlags() & NodeAttrs::PhiRef) {
>          NodeAddr<PhiNode *> PA = UA.Addr->getOwner(*DFG);
> @@ -580,6 +583,7 @@ bool HexagonOptAddrMode::processBlock(No
>        NodeAddr<StmtNode *> OwnerN = UseN.Addr->getOwner(*DFG);
>        MachineInstr *UseMI = OwnerN.Addr->getCode();
>        unsigned BBNum = UseMI->getParent()->getNumber();
> +      (void)BBNum;
>        DEBUG(dbgs() << "\t\t[MI <BB#" << BBNum << ">]: " << *UseMI <<
> "\n");
>
>        int UseMOnum = -1;
>
>
> _______________________________________________
> 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/20160429/b6b6ad76/attachment.html>


More information about the llvm-commits mailing list