diff options
author | 2023-04-03 12:34:45 +0100 | |
---|---|---|
committer | 2023-04-04 12:31:27 +0000 | |
commit | 76d519b039fcdebf58e05dd42df4dc6cc08251e5 (patch) | |
tree | 9ab4e5e9c6cd0be1c90e6aef425f84e7a90dd960 /compiler/optimizing/inliner.cc | |
parent | edf865bdfba5cd48726b8b668baf2be19a285025 (diff) |
Inline unimplemented intrinsics
There are intrinsics that are unimplemented i.e. we didn't
hand-craft code for them. Allow the inliner to inline those.
Since our optimizations expect InvokeVirtual, I stopped the
de-virtualization of intrinsics. That could be re-added
if we modify optimizations like TryReplaceStringBuilderAppend.
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Test: compiling the APK in the bug and seeing the inline
Bug: 262585898
Fixes: 262585898
Change-Id: I501b69c4ffd9082ca8ffacb1cd1cd5d1ab3668a8
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r-- | compiler/optimizing/inliner.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index c24ac84d37..41dc5eb206 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -182,7 +182,7 @@ bool HInliner::Run() { HInstruction* next = instruction->GetNext(); HInvoke* call = instruction->AsInvoke(); // As long as the call is not intrinsified, it is worth trying to inline. - if (call != nullptr && call->GetIntrinsic() == Intrinsics::kNone) { + if (call != nullptr && !codegen_->IsImplementedIntrinsic(call)) { if (honor_noinline_directives) { // Debugging case: directives in method names control or assert on inlining. std::string callee_name = @@ -1272,6 +1272,13 @@ bool HInliner::TryDevirtualize(HInvoke* invoke_instruction, return false; } + // Don't try to devirtualize intrinsics as it breaks pattern matching from later phases. + // TODO(solanes): This `if` could be removed if we update optimizations like + // TryReplaceStringBuilderAppend. + if (invoke_instruction->IsIntrinsic()) { + return false; + } + // Don't bother trying to call directly a default conflict method. It // doesn't have a proper MethodReference, but also `GetCanonicalMethod` // will return an actual default implementation. @@ -1344,7 +1351,7 @@ bool HInliner::TryInlineAndReplace(HInvoke* invoke_instruction, ReferenceTypeInfo receiver_type, bool do_rtp, bool is_speculative) { - DCHECK(!invoke_instruction->IsIntrinsic()); + DCHECK(!codegen_->IsImplementedIntrinsic(invoke_instruction)); HInstruction* return_replacement = nullptr; if (!TryBuildAndInline( |