[llvm] r333415 - [PowerPC] Fix the incorrect iterator inside peephole
Lei Huang via llvm-commits
llvm-commits at lists.llvm.org
Tue May 29 06:38:56 PDT 2018
Author: lei
Date: Tue May 29 06:38:56 2018
New Revision: 333415
URL: http://llvm.org/viewvc/llvm-project?rev=333415&view=rev
Log:
[PowerPC] Fix the incorrect iterator inside peephole
Instruction selection can insert nodes into the underlying list after the root
node so iterating will thereby miss it. We should NOT assume that, the root node
is the last element in the DAG nodelist.
Patch by: steven.zhang (Qing Shan Zhang)
Differential Revision: https://reviews.llvm.org/D47437
Modified:
llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/PowerPC/ppcf128-endian.ll
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=333415&r1=333414&r2=333415&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue May 29 06:38:56 2018
@@ -5169,8 +5169,7 @@ void PPCDAGToDAGISel::foldBoolExts(SDVal
}
void PPCDAGToDAGISel::PreprocessISelDAG() {
- SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
- ++Position;
+ SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
bool MadeChange = false;
while (Position != CurDAG->allnodes_begin()) {
@@ -5858,8 +5857,7 @@ void PPCDAGToDAGISel::PeepholePPC64ZExt(
// unnecessary. When that happens, we remove it here, and redefine the
// relevant 32-bit operation to be a 64-bit operation.
- SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
- ++Position;
+ SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
bool MadeChange = false;
while (Position != CurDAG->allnodes_begin()) {
@@ -6016,8 +6014,7 @@ void PPCDAGToDAGISel::PeepholePPC64() {
if (PPCSubTarget->isDarwin() || !PPCSubTarget->isPPC64())
return;
- SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
- ++Position;
+ SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
while (Position != CurDAG->allnodes_begin()) {
SDNode *N = &*--Position;
Modified: llvm/trunk/test/CodeGen/PowerPC/ppcf128-endian.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppcf128-endian.ll?rev=333415&r1=333414&r2=333415&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/ppcf128-endian.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/ppcf128-endian.ll Tue May 29 06:38:56 2018
@@ -43,10 +43,10 @@ entry:
; CHECK: .LCPI[[LC]]_1:
; CHECK: .long 0
; CHECK: @caller_const
-; CHECK: addi [[REG0:[0-9]+]], {{[0-9]+}}, .LCPI[[LC]]_0
-; CHECK: addi [[REG1:[0-9]+]], {{[0-9]+}}, .LCPI[[LC]]_1
-; CHECK: lfs 1, 0([[REG0]])
-; CHECK: lfs 2, 0([[REG1]])
+; CHECK: addis [[REG0:[0-9]+]], 2, .LCPI[[LC]]_0 at toc@ha
+; CHECK: addis [[REG1:[0-9]+]], 2, .LCPI[[LC]]_1 at toc@ha
+; CHECK: lfs 1, .LCPI[[LC]]_0 at toc@l([[REG0]])
+; CHECK: lfs 2, .LCPI[[LC]]_1 at toc@l([[REG1]])
; CHECK: bl test
define ppc_fp128 @result() {
More information about the llvm-commits
mailing list