1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-08 12:06:26 +00:00

[vm] Fix representation for constant used for ShiftLeft binary op.

The constant has to be boxed value, can't be unboxed.

Fixes=dartbug.com/55003
TEST=regress_55003_test

Change-Id: Ia4d61364f54f8a08a0fe621cc1b4fb5597b1836e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355304
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Aprelev 2024-03-04 19:50:49 +00:00 committed by Commit Queue
parent 84e6764dca
commit d4a9866520
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,17 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
int var64 = -1;
num var68 = 2;
@pragma("vm:always-consider-inlining")
Set<bool>? foo0_1() {
return <bool>{
(8 <= (((var64 + -90) * 9223372034707292160) % var68)),
};
}
main() {
foo0_1();
}

View File

@ -2443,7 +2443,7 @@ Definition* BinaryIntegerOpInstr::Canonicalize(FlowGraph* flow_graph) {
} else if ((rhs > 0) && Utils::IsPowerOfTwo(rhs)) {
const int64_t shift_amount = Utils::ShiftForPowerOfTwo(rhs);
ConstantInstr* constant_shift_amount = flow_graph->GetConstant(
Smi::Handle(Smi::New(shift_amount)), representation());
Smi::Handle(Smi::New(shift_amount)), kTagged);
BinaryIntegerOpInstr* shift = BinaryIntegerOpInstr::Make(
representation(), Token::kSHL, left()->CopyWithType(),
new Value(constant_shift_amount), GetDeoptId(), can_overflow(),