[llvm] r312857 - [X86] Call removeDeadNode when we're done doing custom isel for mul, div and test
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 22:57:21 PDT 2017
Author: ctopper
Date: Fri Sep 8 22:57:20 2017
New Revision: 312857
URL: http://llvm.org/viewvc/llvm-project?rev=312857&view=rev
Log:
[X86] Call removeDeadNode when we're done doing custom isel for mul, div and test
Summary:
Once we've done our custom isel for these nodes, I think we should be calling removeDeadNode to prune them out of the DAG. Table driven isel ultimately either calls morphNodeTo which modifies a node and doesn't leave dead nodes. Or it emits new nodes and then calls removeDeadNode as part of Opc_CompleteMatch.
If you run a simple multiply test case like this through llc with -debug you'll see a umul_lohi node get printed as part of the dump for Instruction Selection ends.
```
define i64 @foo(i64 %a, i64 %b) local_unnamed_addr #0 {
entry:
%conv = zext i64 %a to i128
%conv1 = zext i64 %b to i128
%mul = mul nuw nsw i128 %conv1, %conv
%shr = lshr i128 %mul, 64
%conv2 = trunc i128 %shr to i64
ret i64 %conv2
}
```
Reviewers: RKSimon, spatel, zvi, guyblank, niravd
Reviewed By: niravd
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37547
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=312857&r1=312856&r2=312857&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 8 22:57:20 2017
@@ -2612,6 +2612,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
DEBUG(dbgs() << "=> "; ResHi.getNode()->dump(CurDAG); dbgs() << '\n');
}
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2796,6 +2797,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
ReplaceUses(SDValue(Node, 1), Result);
DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
}
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2854,6 +2856,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2889,6 +2892,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2909,6 +2913,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2929,6 +2934,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
}
More information about the llvm-commits
mailing list