Merge pull request #75 from google/fix-vs2013-debug
SPV non-determinism: Fixed subtle issue that causes tests to fail in VS2013 in some configs.
This commit is contained in:
commit
ff4f04dd0e
@ -2304,9 +2304,18 @@ Builder::Loop::Loop(Builder& builder, bool testFirstArg)
|
|||||||
merge(new Block(builder.getUniqueId(), *function)),
|
merge(new Block(builder.getUniqueId(), *function)),
|
||||||
body(new Block(builder.getUniqueId(), *function)),
|
body(new Block(builder.getUniqueId(), *function)),
|
||||||
testFirst(testFirstArg),
|
testFirst(testFirstArg),
|
||||||
isFirstIteration(testFirst
|
isFirstIteration(nullptr)
|
||||||
? nullptr
|
{
|
||||||
: new Instruction(builder.getUniqueId(), builder.makeBoolType(), OpPhi))
|
if (!testFirst)
|
||||||
{}
|
{
|
||||||
|
// You may be tempted to rewrite this as
|
||||||
|
// new Instruction(builder.getUniqueId(), builder.makeBoolType(), OpPhi);
|
||||||
|
// This will cause subtle test failures because builder.getUniqueId(),
|
||||||
|
// and builder.makeBoolType() can then get run in a compiler-specific
|
||||||
|
// order making tests fail for certain configurations.
|
||||||
|
Id instructionId = builder.getUniqueId();
|
||||||
|
isFirstIteration = new Instruction(instructionId, builder.makeBoolType(), OpPhi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}; // end spv namespace
|
}; // end spv namespace
|
||||||
|
@ -564,8 +564,9 @@ protected:
|
|||||||
const bool testFirst;
|
const bool testFirst;
|
||||||
// When the test executes after the body, this is defined as the phi
|
// When the test executes after the body, this is defined as the phi
|
||||||
// instruction that tells us whether we are on the first iteration of
|
// instruction that tells us whether we are on the first iteration of
|
||||||
// the loop. Otherwise this is null.
|
// the loop. Otherwise this is null. This is non-const because
|
||||||
Instruction* const isFirstIteration;
|
// it has to be initialized outside of the initializer-list.
|
||||||
|
Instruction* isFirstIteration;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Our loop stack.
|
// Our loop stack.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user