Commit 4d5f5879 authored by ulan's avatar ulan Committed by Commit bot

[turbofan] Fix -Wsign-compare warnings.

BUG=v8:5614

Review-Url: https://codereview.chromium.org/2490973002
Cr-Commit-Position: refs/heads/master@{#40879}
parent 58a75305
......@@ -96,8 +96,10 @@ void UpdateBlockControl(BasicBlock* block,
// Update all inputs to the given control node with the correct control.
DCHECK(control->opcode() == IrOpcode::kMerge ||
control->op()->ControlInputCount() == block->PredecessorCount());
if (control->op()->ControlInputCount() != block->PredecessorCount()) {
static_cast<size_t>(control->op()->ControlInputCount()) ==
block->PredecessorCount());
if (static_cast<size_t>(control->op()->ControlInputCount()) !=
block->PredecessorCount()) {
return; // We already re-wired the control inputs of this node.
}
for (int i = 0; i < control->op()->ControlInputCount(); i++) {
......
......@@ -420,7 +420,7 @@ bool IsEquivalentPhi(Node* node1, Node* node2) {
bool IsEquivalentPhi(Node* phi, ZoneVector<Node*>& inputs) {
if (phi->opcode() != IrOpcode::kPhi) return false;
if (phi->op()->ValueInputCount() != inputs.size()) {
if (static_cast<size_t>(phi->op()->ValueInputCount()) != inputs.size()) {
return false;
}
for (size_t i = 0; i < inputs.size(); ++i) {
......@@ -481,9 +481,9 @@ bool VirtualObject::MergeFrom(MergeCache* cache, Node* at, Graph* graph,
SetField(i, field);
TRACE(" Field %zu agree on rep #%d\n", i, field->id());
} else {
int arity = at->opcode() == IrOpcode::kEffectPhi
? at->op()->EffectInputCount()
: at->op()->ValueInputCount();
size_t arity = at->opcode() == IrOpcode::kEffectPhi
? at->op()->EffectInputCount()
: at->op()->ValueInputCount();
if (cache->fields().size() == arity) {
changed = MergeFields(i, at, cache, graph, common) || changed;
} else {
......
......@@ -242,7 +242,7 @@ void Int64Lowering::LowerNode(Node* node) {
case IrOpcode::kStart: {
int parameter_count = GetParameterCountAfterLowering(signature());
// Only exchange the node if the parameter count actually changed.
if (parameter_count != signature()->parameter_count()) {
if (parameter_count != static_cast<int>(signature()->parameter_count())) {
int delta =
parameter_count - static_cast<int>(signature()->parameter_count());
int new_output_count = node->op()->ValueOutputCount() + delta;
......@@ -257,7 +257,7 @@ void Int64Lowering::LowerNode(Node* node) {
// the only input of a parameter node, only changes if the parameter count
// changes.
if (GetParameterCountAfterLowering(signature()) !=
signature()->parameter_count()) {
static_cast<int>(signature()->parameter_count())) {
int old_index = ParameterIndexOf(node->op());
int new_index = GetParameterIndexAfterLowering(signature(), old_index);
NodeProperties::ChangeOp(node, common()->Parameter(new_index));
......@@ -275,7 +275,7 @@ void Int64Lowering::LowerNode(Node* node) {
case IrOpcode::kReturn: {
DefaultLowering(node);
int new_return_count = GetReturnCountAfterLowering(signature());
if (signature()->return_count() != new_return_count) {
if (static_cast<int>(signature()->return_count()) != new_return_count) {
NodeProperties::ChangeOp(node, common()->Return(new_return_count));
}
break;
......
......@@ -137,7 +137,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
case IrOpcode::kStart: {
int parameter_count = GetParameterCountAfterLowering();
// Only exchange the node if the parameter count actually changed.
if (parameter_count != signature()->parameter_count()) {
if (parameter_count != static_cast<int>(signature()->parameter_count())) {
int delta =
parameter_count - static_cast<int>(signature()->parameter_count());
int new_output_count = node->op()->ValueOutputCount() + delta;
......@@ -151,7 +151,8 @@ void SimdScalarLowering::LowerNode(Node* node) {
// not even have to do the default lowering because the the start node,
// the only input of a parameter node, only changes if the parameter count
// changes.
if (GetParameterCountAfterLowering() != signature()->parameter_count()) {
if (GetParameterCountAfterLowering() !=
static_cast<int>(signature()->parameter_count())) {
int old_index = ParameterIndexOf(node->op());
int new_index = GetParameterIndexAfterLowering(signature(), old_index);
if (old_index == new_index) {
......@@ -177,7 +178,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
case IrOpcode::kReturn: {
DefaultLowering(node);
int new_return_count = GetReturnCountAfterLowering(signature());
if (signature()->return_count() != new_return_count) {
if (static_cast<int>(signature()->return_count()) != new_return_count) {
NodeProperties::ChangeOp(node, common()->Return(new_return_count));
}
break;
......
......@@ -30,7 +30,7 @@ class SimdScalarLowering {
enum class SimdType : uint8_t { kInt32, kFloat32 };
static const size_t kMaxLanes = 4;
static const int kMaxLanes = 4;
struct Replacement {
Node* node[kMaxLanes];
......
......@@ -1123,7 +1123,8 @@ TEST(ValidateCallExpression) {
for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
const auto* test = kTests + ii;
CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)",
test->expression) < kFullTestSize);
test->expression) <
static_cast<int>(kFullTestSize));
if (!ValidationOf(Expression(full_test))
->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround)
->WithGlobal(DynamicGlobal("a_float_function"), v2f)
......@@ -1154,7 +1155,8 @@ TEST(ValidateCallExpression) {
for (size_t ii = 0; ii < arraysize(kFailureTests); ++ii) {
const auto* test = kFailureTests + ii;
CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)",
test->expression) < kFullTestSize);
test->expression) <
static_cast<int>(kFullTestSize));
if (!ValidationOf(Expression(full_test))
->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround)
->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int())
......
......@@ -988,12 +988,13 @@ void TestRunOobCheckedLoad_pseudo(uint64_t x, bool length_is_immediate) {
for (uint32_t i = 0; i < kNumElems; i++) {
uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t));
uint32_t expected = buffer[i];
CHECK_EQ(expected, m.Call(offset + pseudo_base, kLength));
CHECK_EQ(expected,
static_cast<uint32_t>(m.Call(offset + pseudo_base, kLength)));
}
// slightly out-of-bounds accesses.
for (int32_t i = kNumElems; i < kNumElems + 30; i++) {
uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t));
for (uint32_t i = kNumElems; i < kNumElems + 30; i++) {
uint32_t offset = i * sizeof(int32_t);
CheckOobValue(m.Call(offset + pseudo_base, kLength));
}
......
......@@ -4171,11 +4171,12 @@ TEST(RunInt32PairAddUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(static_cast<uint32_t>((*i + *j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32)));
CHECK_EQ(
static_cast<uint32_t>((*i + *j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32))));
}
}
}
......@@ -4253,11 +4254,12 @@ TEST(RunInt32PairSubUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(static_cast<uint32_t>((*i - *j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32)));
CHECK_EQ(
static_cast<uint32_t>((*i - *j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32))));
}
}
}
......@@ -4335,11 +4337,12 @@ TEST(RunInt32PairMulUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(static_cast<uint32_t>((*i * *j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32)));
CHECK_EQ(
static_cast<uint32_t>((*i * *j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32),
static_cast<uint32_t>(*j & 0xffffffff),
static_cast<uint32_t>(*j >> 32))));
}
}
}
......@@ -4414,9 +4417,10 @@ TEST(RunWord32PairShlUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(static_cast<uint32_t>((*i << j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j));
CHECK_EQ(
static_cast<uint32_t>((*i << j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j)));
}
}
}
......@@ -4487,9 +4491,10 @@ TEST(RunWord32PairShrUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(static_cast<uint32_t>((*i >> j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j));
CHECK_EQ(
static_cast<uint32_t>((*i >> j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j)));
}
}
}
......@@ -4514,7 +4519,7 @@ TEST(RunWord32PairSar) {
for (uint32_t j = 0; j < 64; j++) {
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j);
CHECK_EQ(*i >> j, ToInt64(low, high));
CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high)));
}
}
}
......@@ -4528,9 +4533,10 @@ TEST(RunWord32PairSarUseOnlyHighWord) {
FOR_INT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(static_cast<uint32_t>((*i >> j) >> 32),
m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j));
CHECK_EQ(
static_cast<uint32_t>((*i >> j) >> 32),
static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
static_cast<uint32_t>(*i >> 32), j)));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment