Test for and prevent any dead-code elimination, as all code is needed in the AST for static-use analysis.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23163 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-09-20 06:20:21 +00:00
parent c981efd84d
commit f5ebfb5f27
8 changed files with 255 additions and 36 deletions

View file

@ -688,16 +688,9 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc loc
TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc loc)
{
//
// For compile time constant selections, prune the code and
// test now.
// Don't prune the false path for compile-time constants; it's needed
// for static access analysis.
//
if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
return nodePair.node1;
else
return nodePair.node2;
}
TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
node->setLoc(loc);