Commit a60e0805 by Jamie Madill

Fix issues with the conditional discard workarounds to do with assignments.

The old modifiesState method really checked if an operator was an assignment, so restored that behaviour and use the new side effects detection only for the new code. ANGLEBUG=486 BUG= R=nicolascapens@chromium.org, zmo@chromium.org Review URL: https://codereview.appspot.com/22130043
parent d1ffb561
...@@ -804,9 +804,7 @@ bool TIntermSelection::replaceChildNode( ...@@ -804,9 +804,7 @@ bool TIntermSelection::replaceChildNode(
// //
// Say whether or not an operation node changes the value of a variable. // Say whether or not an operation node changes the value of a variable.
// //
// Returns true if state is modified. bool TIntermOperator::isAssignment() const
//
bool TIntermOperator::hasSideEffects() const
{ {
switch (op) { switch (op) {
case EOpPostIncrement: case EOpPostIncrement:
......
...@@ -457,7 +457,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node) ...@@ -457,7 +457,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
bool ValidateLimitations::validateOperation(TIntermOperator* node, bool ValidateLimitations::validateOperation(TIntermOperator* node,
TIntermNode* operand) { TIntermNode* operand) {
// Check if loop index is modified in the loop body. // Check if loop index is modified in the loop body.
if (!withinLoopBody() || !node->hasSideEffects()) if (!withinLoopBody() || !node->isAssignment())
return true; return true;
const TIntermSymbol* symbol = operand->getAsSymbolNode(); const TIntermSymbol* symbol = operand->getAsSymbolNode();
......
...@@ -94,7 +94,7 @@ void TDependencyGraphBuilder::visitSymbol(TIntermSymbol* intermSymbol) ...@@ -94,7 +94,7 @@ void TDependencyGraphBuilder::visitSymbol(TIntermSymbol* intermSymbol)
bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary* intermBinary) bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary* intermBinary)
{ {
TOperator op = intermBinary->getOp(); TOperator op = intermBinary->getOp();
if (op == EOpInitialize || intermBinary->hasSideEffects()) if (op == EOpInitialize || intermBinary->isAssignment())
visitAssignment(intermBinary); visitAssignment(intermBinary);
else if (op == EOpLogicalAnd || op == EOpLogicalOr) else if (op == EOpLogicalAnd || op == EOpLogicalOr)
visitLogicalOp(intermBinary); visitLogicalOp(intermBinary);
......
...@@ -406,9 +406,11 @@ public: ...@@ -406,9 +406,11 @@ public:
TOperator getOp() const { return op; } TOperator getOp() const { return op; }
void setOp(TOperator o) { op = o; } void setOp(TOperator o) { op = o; }
virtual bool hasSideEffects() const; bool isAssignment() const;
bool isConstructor() const; bool isConstructor() const;
virtual bool hasSideEffects() const { return isAssignment(); }
protected: protected:
TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {} TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {} TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
...@@ -427,7 +429,7 @@ public: ...@@ -427,7 +429,7 @@ public:
virtual bool replaceChildNode( virtual bool replaceChildNode(
TIntermNode *original, TIntermNode *replacement); TIntermNode *original, TIntermNode *replacement);
virtual bool hasSideEffects() const { return (TIntermOperator::hasSideEffects() || left->hasSideEffects() || right->hasSideEffects()); } virtual bool hasSideEffects() const { return (isAssignment() || left->hasSideEffects() || right->hasSideEffects()); }
void setLeft(TIntermTyped* n) { left = n; } void setLeft(TIntermTyped* n) { left = n; }
void setRight(TIntermTyped* n) { right = n; } void setRight(TIntermTyped* n) { right = n; }
...@@ -459,7 +461,7 @@ public: ...@@ -459,7 +461,7 @@ public:
virtual bool replaceChildNode( virtual bool replaceChildNode(
TIntermNode *original, TIntermNode *replacement); TIntermNode *original, TIntermNode *replacement);
virtual bool hasSideEffects() const { return (TIntermOperator::hasSideEffects() || operand->hasSideEffects()); } virtual bool hasSideEffects() const { return (isAssignment() || operand->hasSideEffects()); }
void setOperand(TIntermTyped* o) { operand = o; } void setOperand(TIntermTyped* o) { operand = o; }
TIntermTyped* getOperand() { return operand; } TIntermTyped* getOperand() { return operand; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment