1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[coroutines] Make CoroSplit pass deterministic

coro-split-after-phi.ll test was flaky due to non-determinism in
the coroutine frame construction that was sorting the spill
vector using a pointer to a def as a part of the key.

The sorting was intended to make sure that spills for the same def
are kept together, however, we populate the vector by processing
defs in order, so the spill entires will end up together anyways.

This change removes spill sorting and restores the determinism
in the test.

llvm-svn: 299809
This commit is contained in:
Gor Nishanov 2017-04-08 00:49:46 +00:00
parent fda66d5c47
commit 13a7a6f2a7
2 changed files with 4 additions and 8 deletions

View File

@ -705,7 +705,6 @@ void coro::buildCoroutineFrame(Function &F, Shape &Shape) {
Spills.emplace_back(&I, U);
// Rewrite materializable instructions to be materialized at the use point.
std::sort(Spills.begin(), Spills.end());
DEBUG(dump("Materializations", Spills));
rewriteMaterializableInstructions(Builder, Spills);
@ -737,7 +736,6 @@ void coro::buildCoroutineFrame(Function &F, Shape &Shape) {
Spills.emplace_back(&I, U);
}
}
std::sort(Spills.begin(), Spills.end());
DEBUG(dump("Spills", Spills));
moveSpillUsesAfterCoroBegin(F, Spills, Shape.CoroBegin);
Shape.FrameTy = buildFrameType(F, Shape, Spills);

View File

@ -38,12 +38,10 @@ suspend:
; CHECK: store void (%f.Frame*)* @f.destroy, void (%f.Frame*)** %destroy.addr
; CHECK: %phi1 = select i1 %n, i32 0, i32 2
; CHECK: %phi2 = select i1 %n, i32 1, i32 3
; FIXME: The ordering of these spills is non-determinstic. Remove -DAG and the
; (4|5) regex when that's fixed.
; CHECK-DAG: %phi2.spill.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 {{(4|5)}}
; CHECK-DAG: store i32 %phi2, i32* %phi2.spill.addr
; CHECK-DAG: %phi1.spill.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 {{(4|5)}}
; CHECK-DAG: store i32 %phi1, i32* %phi1.spill.addr
; CHECK: %phi2.spill.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 5
; CHECK: store i32 %phi2, i32* %phi2.spill.addr
; CHECK: %phi1.spill.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 4
; CHECK: store i32 %phi1, i32* %phi1.spill.addr
; CHECK: ret i8* %hdl
declare i8* @llvm.coro.free(token, i8*)