OSDN Git Service

SDAG: Avoid relying on the return value of SelectCode in Hexagon. NFC
authorJustin Bogner <mail@justinbogner.com>
Tue, 10 May 2016 20:31:53 +0000 (20:31 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 10 May 2016 20:31:53 +0000 (20:31 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269112 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonISelDAGToDAG.cpp

index 9155f95..c782638 100644 (file)
@@ -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) {