From dcb7a821b874085e2a1bdcc780dd3d0e72a43d84 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 10 May 2016 20:31:53 +0000 Subject: [PATCH] SDAG: Avoid relying on the return value of SelectCode in Hexagon. NFC This is a bit of a spot fix for now. I'll try to fix this up more comprehensively soon. This is part of the work to have Select return void instead of an SDNode *, which is in turn part of llvm.org/pr26808. llvm-svn: 269112 --- llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp index 9155f95788cf..c782638123b4 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp @@ -570,7 +570,13 @@ SDNode *HexagonDAGToDAGISel::StoreInstrForLoadIntrinsic(MachineSDNode *LoadN, else TS = CurDAG->getTruncStore(SDValue(LoadN,2), dl, SDValue(LoadN,0), Loc, PI, MVT::getIntegerVT(Size*8), false, false, Size); - SDNode *StoreN = SelectStore(TS.getNode()); + + SDNode *StoreN; + { + HandleSDNode Handle(TS); + SelectStore(TS.getNode()); + StoreN = Handle.getValue().getNode(); + } // Load's results are { Loaded value, Updated pointer, Chain } ReplaceUses(SDValue(IntN, 0), SDValue(LoadN, 1)); @@ -720,7 +726,8 @@ SDNode *HexagonDAGToDAGISel::SelectIndexedStore(StoreSDNode *ST, SDLoc dl) { ReplaceUses(ST, Result); ReplaceUses(SDValue(ST,1), SDValue(Result,1)); - return Result; + CurDAG->RemoveDeadNode(ST); + return nullptr; } // Note: Order of operands matches the def of instruction: @@ -767,7 +774,8 @@ SDNode *HexagonDAGToDAGISel::SelectIndexedStore(StoreSDNode *ST, SDLoc dl) { ReplaceUses(SDValue(ST,0), SDValue(Result_2,0)); ReplaceUses(SDValue(ST,1), SDValue(Result_1,0)); - return Result_2; + CurDAG->RemoveDeadNode(ST); + return nullptr; } SDNode *HexagonDAGToDAGISel::SelectStore(SDNode *N) {