summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-02-10 16:01:41 -0800
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-02-10 16:01:41 -0800
commit33f34dd5e29a8015cd4d398adccbeb1c7e8e77c4 (patch)
treef284c1a0c7b506a04bad1e11e5efda2e352c3cbd /compiler/optimizing
parent60f3f950e3cf7516416fea18d18bdb81c87e087a (diff)
parent3570e0ffd5ff63b856710e6b7cae549d88909ab4 (diff)
Snap for 13039724 from 3570e0ffd5ff63b856710e6b7cae549d88909ab4 to 25Q2-release
Change-Id: I67f6a86c55fc9f0ea112aa2aa3731832876b72fe
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_generator.h1
-rw-r--r--compiler/optimizing/induction_var_range.cc5
-rw-r--r--compiler/optimizing/nodes.cc14
3 files changed, 11 insertions, 9 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 3919bb0cc1..b118e9a7d0 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -703,7 +703,6 @@ class CodeGenerator : public DeletableArenaObject<kArenaAllocCodeGenerator> {
return EmitReadBarrier()
? LocationSummary::kCallOnSlowPath
: LocationSummary::kNoCall;
- break;
default:
DCHECK(!load->NeedsEnvironment());
return LocationSummary::kNoCall;
diff --git a/compiler/optimizing/induction_var_range.cc b/compiler/optimizing/induction_var_range.cc
index 2f5a22ec0e..1fa2724641 100644
--- a/compiler/optimizing/induction_var_range.cc
+++ b/compiler/optimizing/induction_var_range.cc
@@ -48,10 +48,11 @@ static bool IsSafeDiv(int32_t c1, int32_t c2) {
/** Computes a * b for a,b > 0 (at least until first overflow happens). */
static int64_t SafeMul(int64_t a, int64_t b, /*out*/ bool* overflow) {
- if (a > 0 && b > 0 && a > (std::numeric_limits<int64_t>::max() / b)) {
+ int64_t result;
+ if (__builtin_mul_overflow(a, b, &result)) {
*overflow = true;
}
- return a * b;
+ return result;
}
/** Returns b^e for b,e > 0. Sets overflow if arithmetic wrap-around occurred. */
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index ece11435db..8044a86338 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1332,17 +1332,19 @@ void HInstructionList::InsertInstructionAfter(HInstruction* instruction, HInstru
}
void HInstructionList::RemoveInstruction(HInstruction* instruction) {
- if (instruction->previous_ != nullptr) {
- instruction->previous_->next_ = instruction->next_;
- }
- if (instruction->next_ != nullptr) {
- instruction->next_->previous_ = instruction->previous_;
- }
+ DCHECK_EQ(instruction->previous_ == nullptr, instruction == first_instruction_);
+ DCHECK_EQ(instruction->next_ == nullptr, instruction == last_instruction_);
+
if (instruction == first_instruction_) {
first_instruction_ = instruction->next_;
+ } else {
+ instruction->previous_->next_ = instruction->next_;
}
+
if (instruction == last_instruction_) {
last_instruction_ = instruction->previous_;
+ } else {
+ instruction->next_->previous_ = instruction->previous_;
}
}