Commit bc4ea5e0 authored by Nico Weber's avatar Nico Weber Committed by V8 LUCI CQ

Fix Wbitwise-instead-of-logical warnings

`a && b` only evaluates b if a is true. `a & b` always evaluates
both a and b. If a and b are of type bool, `&&` is usually what you
want, so clang now warns on `&` where both arguments are of type bool.

This warning fires twice in v8.

1. In branch-elimination.cc, we have the rare case where we _want_
   to evaluate both branches so that both reduced_ and node_conditions_
   are always updated. To make this more obvious, reorder the code a
   bit. (The warning can also be suppressed by casting one of the two
   expressions to int, but the reordering seems clearer.)

2. The other case is an actual (inconsequential) typo, so use || here.

Bug: chromium:1255745
Change-Id: I62ba45451ee2642265574d28c646d85f5a18670b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3212891
Auto-Submit: Nico Weber <thakis@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77314}
parent 2a0bc36d
......@@ -415,7 +415,9 @@ Reduction BranchElimination::UpdateConditions(
Node* node, ControlPathConditions conditions) {
// Only signal that the node has Changed if the condition information has
// changed.
if (reduced_.Set(node, true) | node_conditions_.Set(node, conditions)) {
bool reduced_changed = reduced_.Set(node, true);
bool node_conditions_changed = node_conditions_.Set(node, conditions);
if (reduced_changed || node_conditions_changed) {
return Changed(node);
}
return NoChange();
......
......@@ -1446,7 +1446,7 @@ void FeedbackNexus::ResetTypeProfile() {
FeedbackIterator::FeedbackIterator(const FeedbackNexus* nexus)
: done_(false), index_(-1), state_(kOther) {
DCHECK(IsLoadICKind(nexus->kind()) ||
IsStoreICKind(nexus->kind()) | IsKeyedLoadICKind(nexus->kind()) ||
IsStoreICKind(nexus->kind()) || IsKeyedLoadICKind(nexus->kind()) ||
IsKeyedStoreICKind(nexus->kind()) || IsStoreOwnICKind(nexus->kind()) ||
IsStoreDataPropertyInLiteralKind(nexus->kind()) ||
IsStoreInArrayLiteralICKind(nexus->kind()) ||
......
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