[llvm] r299809 - [coroutines] Make CoroSplit pass deterministic
Gor Nishanov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 7 17:49:47 PDT 2017
Author: gornishanov
Date: Fri Apr 7 19:49:46 2017
New Revision: 299809
URL: http://llvm.org/viewvc/llvm-project?rev=299809&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/trunk/test/Transforms/Coroutines/coro-spill-after-phi.ll
Modified: llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp?rev=299809&r1=299808&r2=299809&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp (original)
+++ llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp Fri Apr 7 19:49:46 2017
@@ -705,7 +705,6 @@ void coro::buildCoroutineFrame(Function
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
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);
Modified: llvm/trunk/test/Transforms/Coroutines/coro-spill-after-phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Coroutines/coro-spill-after-phi.ll?rev=299809&r1=299808&r2=299809&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Coroutines/coro-spill-after-phi.ll (original)
+++ llvm/trunk/test/Transforms/Coroutines/coro-spill-after-phi.ll Fri Apr 7 19:49:46 2017
@@ -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*)
More information about the llvm-commits
mailing list