aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4ssa.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-02-09 21:11:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-22 16:48:00 +0100
commita5bb33e7cbea30fe9f3ea44d70afc37831683fc3 (patch)
treed4bc2635720653f5da801a508f030a467976b397 /src/qml/compiler/qv4ssa.cpp
parent48b44dc163953d78338dc884316344c377afd41f (diff)
Really eliminate a|0 and b&(-1)
The old code wasn't doing what it promised to do and failed to remove these expressions. Change-Id: I6718539fd528f293db537e47ff1c9ac4b27ada55 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r--src/qml/compiler/qv4ssa.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index dcee3ea4cd..83d0f24e98 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -3367,16 +3367,16 @@ void optimizeSSA(Function *function, DefUsesCalculator &defUses, DominatorTree &
Expr *casted = 0;
switch (binop->op) {
case OpBitAnd:
- if (leftConst && !rightConst && leftConst->value == 0xffffffff)
- casted = rightConst;
- else if (!leftConst && rightConst && rightConst->value == 0xffffffff)
- casted = leftConst;
+ if (leftConst && !rightConst && QV4::Primitive::toUInt32(leftConst->value) == 0xffffffff)
+ casted = binop->right;
+ else if (!leftConst && rightConst && QV4::Primitive::toUInt32(rightConst->value) == 0xffffffff)
+ casted = binop->left;
break;
case OpBitOr:
- if (leftConst && !rightConst && leftConst->value == 0)
- casted = rightConst;
- else if (!leftConst && rightConst && rightConst->value == 0)
- casted = leftConst;
+ if (leftConst && !rightConst && QV4::Primitive::toInt32(leftConst->value) == 0)
+ casted = binop->right;
+ else if (!leftConst && rightConst && QV4::Primitive::toUInt32(rightConst->value) == 0)
+ casted = binop->left;
break;
default:
break;