[PATCH] D37547: [X86] Call removeDeadNode when we're done doing custom isel for mul, div and test
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 18:13:23 PDT 2017
craig.topper created this revision.
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
}
https://reviews.llvm.org/D37547
Files:
lib/Target/X86/X86ISelDAGToDAG.cpp
Index: lib/Target/X86/X86ISelDAGToDAG.cpp
===================================================================
--- lib/Target/X86/X86ISelDAGToDAG.cpp
+++ lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2455,6 +2455,7 @@
DEBUG(dbgs() << "=> "; ResHi.getNode()->dump(CurDAG); dbgs() << '\n');
}
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2639,6 +2640,7 @@
ReplaceUses(SDValue(Node, 1), Result);
DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
}
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2697,6 +2699,7 @@
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2732,6 +2735,7 @@
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2752,6 +2756,7 @@
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
@@ -2772,6 +2777,7 @@
// one, do not call ReplaceAllUsesWith.
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
SDValue(NewNode, 0));
+ CurDAG->RemoveDeadNode(Node);
return;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37547.114111.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170907/6f2494f5/attachment.bin>
More information about the llvm-commits
mailing list