Fix PR3457: Ignore control successors when looking for closest scheduled successor. A control successor doesn't read result(s) produced by the scheduling unit being evaluated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2009-02-10 08:30:11 +00:00
parent f66d7b5a51
commit f0e366a929
4 changed files with 24 additions and 3 deletions

View File

@ -30,7 +30,6 @@
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include <climits> #include <climits>
#include "llvm/Support/CommandLine.h"
using namespace llvm; using namespace llvm;
STATISTIC(NumBacktracks, "Number of times scheduler backtracked"); STATISTIC(NumBacktracks, "Number of times scheduler backtracked");
@ -1047,6 +1046,7 @@ static unsigned closestSucc(const SUnit *SU) {
unsigned MaxHeight = 0; unsigned MaxHeight = 0;
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) { I != E; ++I) {
if (I->isCtrl()) continue; // ignore chain succs
unsigned Height = I->getSUnit()->getHeight(); unsigned Height = I->getSUnit()->getHeight();
// If there are bunch of CopyToRegs stacked up, they should be considered // If there are bunch of CopyToRegs stacked up, they should be considered
// to be at the same position. // to be at the same position.

View File

@ -1,6 +1,9 @@
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldmia
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrb ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrb
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrh ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrh
; This used to look for ldmia. But it's no longer lucky enough to
; have the load / store instructions lined up just right after
; scheduler change for pr3457. We'll look for a robust solution
; later.
%struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } %struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
@src = external global %struct.x @src = external global %struct.x

View File

@ -1,8 +1,10 @@
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep pcmpeqd | count 1 ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep pcmpeqd
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep orps | grep CPI1_2 | count 2
; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep pcmpeqd | count 1 ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep pcmpeqd | count 1
; This testcase shouldn't need to spill the -1 value, ; This testcase shouldn't need to spill the -1 value,
; so it should just use pcmpeqd to materialize an all-ones vector. ; so it should just use pcmpeqd to materialize an all-ones vector.
; For i386, cp load of -1 are folded.
%struct.__ImageExecInfo = type <{ <4 x i32>, <4 x float>, <2 x i64>, i8*, i8*, i8*, i32, i32, i32, i32, i32 }> %struct.__ImageExecInfo = type <{ <4 x i32>, <4 x float>, <2 x i64>, i8*, i8*, i8*, i32, i32, i32, i32, i32 }>
%struct._cl_image_format_t = type <{ i32, i32, i32 }> %struct._cl_image_format_t = type <{ i32, i32, i32 }>

View File

@ -0,0 +1,16 @@
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep fstpt
; PR3457
; rdar://6548010
define void @foo(double* nocapture %P) nounwind {
entry:
%0 = tail call double (...)* @test() nounwind ; <double> [#uses=2]
%1 = tail call double (...)* @test() nounwind ; <double> [#uses=2]
%2 = mul double %0, %0 ; <double> [#uses=1]
%3 = mul double %1, %1 ; <double> [#uses=1]
%4 = add double %2, %3 ; <double> [#uses=1]
store double %4, double* %P, align 8
ret void
}
declare double @test(...)