Revert "Make sure type gets set consistently in folded binary operations"
This is blocking the revert of the geometric constant folding
patch, which is breaking gpu_unittests and blocking the roll.
BUG=angleproject:817
This reverts commit b07aba0798d3bba3118dac78933e73b3f08a601b.
Change-Id: Ia00fc45b1ddd9d3c079742dea0627aa12304f93b
Reviewed-on: https://chromium-review.googlesource.com/275321
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index 5762b1e..1d8b36b 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -57,10 +57,19 @@
if (!node->promote(mInfoSink))
return NULL;
+ //
// See if we can fold constants.
- TIntermTyped *foldedNode = node->fold(mInfoSink);
- if (foldedNode)
- return foldedNode;
+ //
+ TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
+ TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
+ if (leftTempConstant && rightTempConstant)
+ {
+ TIntermTyped *typedReturnNode =
+ leftTempConstant->fold(node->getOp(), rightTempConstant, mInfoSink);
+
+ if (typedReturnNode)
+ return typedReturnNode;
+ }
return node;
}
@@ -134,7 +143,7 @@
if (childTempConstant)
{
- TIntermTyped *newChild = childTempConstant->foldUnary(op, mInfoSink);
+ TIntermTyped *newChild = childTempConstant->fold(op, nullptr, mInfoSink);
if (newChild)
return newChild;