llvm.org GIT mirror llvm / 5ba8bf6
When the scheduler unfold a load folding instruction it move some of the predecessors to the unfolded load. It decides what gets moved to the load by checking whether the new load is using the predecessor as an operand. The check neglects the cases whether the predecessor is a flagged scheduling unit. rdar://7604000 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95339 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 10 years ago
2 changed file(s) with 38 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
344344 ++NumBacktracks;
345345 }
346346
347 static bool isOperandOf(const SUnit *SU, SDNode *N) {
348 for (const SDNode *SUNode = SU->getNode(); SUNode;
349 SUNode = SUNode->getFlaggedNode()) {
350 if (SUNode->isOperandOf(N))
351 return true;
352 }
353 return false;
354 }
355
347356 /// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
348357 /// successors to the newly created node.
349358 SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
426435 I != E; ++I) {
427436 if (I->isCtrl())
428437 ChainPreds.push_back(*I);
429 else if (I->getSUnit()->getNode() &&
430 I->getSUnit()->getNode()->isOperandOf(LoadNode))
438 else if (isOperandOf(I->getSUnit(), LoadNode))
431439 LoadPreds.push_back(*I);
432440 else
433441 NodePreds.push_back(*I);
0 ; RUN: llc < %s -mtriple=i386-apple-darwin11
1 ; rdar://7604000
2
3 %struct.a_t = type { i8*, i64*, i8*, i32, i32, i64*, i64*, i64* }
4 %struct.b_t = type { i32, i32, i32, i32, i64, i64, i64, i64 }
5
6 define void @t(i32 %cNum, i64 %max) nounwind optsize ssp noimplicitfloat {
7 entry:
8 %0 = load %struct.b_t** null, align 4 ; <%struct.b_t*> [#uses=1]
9 %1 = getelementptr inbounds %struct.b_t* %0, i32 %cNum, i32 5 ; [#uses=1]
10 %2 = load i64* %1, align 4 ; [#uses=1]
11 %3 = icmp ult i64 %2, %max ; [#uses=1]
12 %4 = getelementptr inbounds %struct.a_t* null, i32 0, i32 7 ; [#uses=1]
13 %5 = load i64** %4, align 4 ; [#uses=0]
14 %6 = load i64* null, align 4 ; [#uses=1]
15 br i1 %3, label %bb2, label %bb
16
17 bb: ; preds = %entry
18 br label %bb3
19
20 bb2: ; preds = %entry
21 %7 = or i64 %6, undef ; [#uses=1]
22 br label %bb3
23
24 bb3: ; preds = %bb2, %bb
25 %misc_enables.0 = phi i64 [ undef, %bb ], [ %7, %bb2 ] ; [#uses=0]
26 ret void
27 }