Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1245)

Issue 1095063002: Use type information to eliminate unnecessary bitwise-and operations.

Created:
5 years, 8 months ago by dougc
Modified:
4 years, 9 months ago
Reviewers:
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Use type information to eliminate unnecessary bitwise-and operations. BUG=

Patch Set 1 #

Total comments: 2

Patch Set 2 : Move the transform to machine-operator-reducer. #

Patch Set 3 : Rework to handle all cases for an int32 range and int32 constant mask. #

Patch Set 4 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -0 lines) Patch
M src/compiler/machine-operator-reducer.cc View 1 2 1 chunk +18 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (2 generated)
dougc
This is a WIP patch with a request for help on how appropriate this solution ...
5 years, 8 months ago (2015-04-20 11:55:23 UTC) #2
titzer
https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lowering.cc File src/compiler/js-typed-lowering.cc (right): https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lowering.cc#newcode373 src/compiler/js-typed-lowering.cc:373: Reduction JSTypedLowering::ReduceBitwiseAnd(Node* node) { I think you want to ...
5 years, 8 months ago (2015-04-20 12:20:40 UTC) #3
dougc
On 2015/04/20 12:20:40, titzer wrote: > https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lowering.cc > File src/compiler/js-typed-lowering.cc (right): > > https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lowering.cc#newcode373 > ...
5 years, 3 months ago (2015-09-13 12:10:03 UTC) #4
titzer
5 years, 3 months ago (2015-09-17 18:49:12 UTC) #5
On 2015/09/13 12:10:03, dougc wrote:
> On 2015/04/20 12:20:40, titzer wrote:
> >
>
https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lower...
> > File src/compiler/js-typed-lowering.cc (right):
> > 
> >
>
https://codereview.chromium.org/1095063002/diff/1/src/compiler/js-typed-lower...
> > src/compiler/js-typed-lowering.cc:373: Reduction
> > JSTypedLowering::ReduceBitwiseAnd(Node* node) {
> > I think you want to move this optimization to machine-operator-reducer. That
> > will make it more general and also avoid the problem you see below. 
> 
> Tried this suggestion, moving this to machine-operator-reducer. It works in
> part, but there are some issues that suggest this is too later to make use of
> this type information.
> 
> For example, for one error there is a bit-and operation being used that
appears
> to be testing the low bit of a value that is the result of converting true or
> false to a number, which I presume is checking for a tagged number. The type
> information gives the input as having the range 0 to 1, so bit-and-ing this
> input with 1 is redundant and is eliminated. But the bit-and is being applied
to
> a lower level representation, to a tagged number, which is not the value that
> the type information applies to and this generates bad code. Does this sound
> right? Does it suggest another appropriate phase to perform transforms that
> depend on type information? Or should the transform be guarding against being
> applied to possibly tagger values?

Ah, yes. The range information is in terms of "semantic integer ranges" and not
in terms of raw machine ranges. So the and's with 1 that you are seeing are tag
checks. We will have to know the correct representation for this optimization to
make sense.

Powered by Google App Engine
This is Rietveld 408576698