Commit f4b79ba8 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 Change-Id: I84d4e95a0457e63f237a814d80e4f72dd861496b
parent 3c9eeb97
#define MAJOR_VERSION 2 #define MAJOR_VERSION 2
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 2017 #define BUILD_REVISION 2018
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -772,9 +772,7 @@ void TIntermediate::remove(TIntermNode* root) ...@@ -772,9 +772,7 @@ void TIntermediate::remove(TIntermNode* root)
// //
// 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:
......
...@@ -461,7 +461,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node) ...@@ -461,7 +461,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);
......
...@@ -410,9 +410,11 @@ public: ...@@ -410,9 +410,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) {}
...@@ -429,7 +431,7 @@ public: ...@@ -429,7 +431,7 @@ public:
virtual TIntermBinary* getAsBinaryNode() { return this; } virtual TIntermBinary* getAsBinaryNode() { return this; }
virtual void traverse(TIntermTraverser*); virtual void traverse(TIntermTraverser*);
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 void traverse(TIntermTraverser*); virtual void traverse(TIntermTraverser*);
virtual TIntermUnary* getAsUnaryNode() { return this; } virtual TIntermUnary* getAsUnaryNode() { return this; }
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