|
Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two.
The IsPowerOfTwo function is used together with ShiftForPowerOfTwo. Both function
do not work with zero. This caused the optimizing compiler to generate invalid code
for the expression
x ? 0 : 0
where it assumed that if one of the constants is a power-of-two, it can
be computed by (1 << n). We check for 0 in a number of places, but instead
I decided to fix Utils::IsPowerOfTwo itself and remove unnecessary checks
for the zero case.
TEST=tests/language/vm/if_conversion_vm_test.dart, runtime/vm/utils_test.cc
R=kmillikin@google.com
Committed: https://code.google.com/p/dart/source/detail?r=27033
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+13 lines, -12 lines) |
Patch |
|
M |
runtime/platform/utils.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/flow_graph_optimizer.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/intermediate_language.cc
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/intermediate_language_arm.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/intermediate_language_ia32.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/intermediate_language_mips.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/intermediate_language_x64.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/utils_test.cc
|
View
|
|
4 chunks |
+1 line, -5 lines |
0 comments
|
Download
|
|
M |
tests/language/vm/if_conversion_vm_test.dart
|
View
|
1
|
3 chunks |
+6 lines, -0 lines |
0 comments
|
Download
|
Total messages: 3 (0 generated)
|