Status Update
Comments
ze...@google.com <ze...@google.com> #2
Thanks for reaching out. The example is showing an actual error in D8, as your compilation mode is using the default mode in the command builder which is "debug". Thus m_instream
can be modified at any time by an attached debugger and it is invalid for D8 to assume its value. Even in release mode compilation if m_instream
is a field D8 would generally also need to assume it could have any value.
I'll investigate what is going on and update here once I have more info.
ms...@gmail.com <ms...@gmail.com> #3
Thanks for looking so quickly! Here is the original source code (it's a single file):
m_instream
and m_outstream
are indeed fields.
ap...@google.com <ap...@google.com> #4
Branch: main
commit 15fe559fd49c3fbb31fdae4a671e65459acd4102
Author: Ian Zerny <zerny@google.com>
Date: Mon Dec 18 09:58:17 2023
Regression test for invalid optimization in D8
Bug:
Change-Id: I3c5ea85c6a8aa32627d4c464a8b3ff475dc85cf5
M src/test/java/com/android/tools/r8/debug/DebugTestBase.java
A src/test/java/com/android/tools/r8/regress/b316744331/Regress316744331Test.java
A src/test/java/com/android/tools/r8/regress/b316744331/Regress316744331TestClass.java
ze...@google.com <ze...@google.com> #5
This issue is caused by running the redundant field load/store elimination in debug mode. That should be disabled.
A previous attempt at disabling failed due to memory regressions:
ze...@google.com <ze...@google.com> #6
FYI, a fix is in CL
It is currently blocked on landing pending some resolution of
ms...@gmail.com <ms...@gmail.com> #7
Thank you!
ms...@gmail.com <ms...@gmail.com> #8
I am curious, is this issue unlikely to be solved in the near future? If so, we will just code up a workaround for now in WALA, so we can continue with updating our r8 dependence. Thanks again!
sg...@google.com <sg...@google.com> #9
It might take a bit of time to look into the concerns from
ap...@google.com <ap...@google.com> #10
Branch: main
commit 6f3ea6138d0dbef4eb3b2b501b53ed48ea86c2d4
Author: Ian Zerny <zerny@google.com>
Date: Tue Dec 19 08:48:47 2023
Disable redundant load elimination in debug mode
Bug:
Bug:
Change-Id: I2df1712dfb920c68feeba2dcdcfc1c735e615993
M src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/regress/b316744331/Regress316744331Test.java
ap...@google.com <ap...@google.com> #11
Branch: main
commit 24659d5eae579cd1db20ffe88f6a634a333e9bfe
Author: Christoffer Adamsen <christofferqa@google.com>
Date: Wed Jan 03 16:11:05 2024
Reland "Disable redundant load elimination in debug mode"
Bug:
Bug:
Change-Id: I1c4fba711609183130735f8b93d0dbe627dec1c1
M src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/regress/b316744331/Regress316744331Test.java
ap...@google.com <ap...@google.com> #12
Branch: main
commit c0b9ea0f3b9dd56f6e301b96d48eb1c583497f24
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Mon Jan 08 10:44:08 2024
Update 911-get-stack-trace after disabling field load elimination
D8 8.4.5-dev disables redundant field load elimination in debug mode.
Bug: 316744331
Change-Id: Iee10c8656266b41ef108d5da1c1716ac27ea8ef9
Test: existing
M test/911-get-stack-trace/expected-stdout.txt
ap...@google.com <ap...@google.com> #13
Branch: 8.0
commit 44de2d3b1a19951abccf33e2412d625b11ca437e
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 09:54:22 2024
Version 8.0.75
Bug:
Change-Id: I7347b09a29ba027dabcb999348422802935d24c7
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #14
Branch: 8.0
commit ab8f6074de78773d0a2796a95ee3285cc6598bcf
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 09:49:33 2024
Reland "Disable redundant load elimination in debug mode"
Notice: this cherry pick is written manually as this branch is from
before the introduction of code rewriter passes.
Bug:
Bug:
Change-Id: I1c4fba711609183130735f8b93d0dbe627dec1c1
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
ap...@google.com <ap...@google.com> #15
Branch: 8.3
commit a7a3e45076d5fa6124376bd48022d4064b148df9
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 14:14:44 2024
Version 8.3.30
Bug:
Change-Id: I7edbb53ca57833a476577c26e766ca7aae001f86
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #16
Branch: 8.3
commit bf16876c41ebee42408696d4be2fb6434f3cf341
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 14:13:53 2024
Reland "Disable redundant load elimination in debug mode"
Notice: this cherry pick is written manually as this branch is from
before the introduction of code rewriter passes.
Bug:
Bug:
Change-Id: I1c4fba711609183130735f8b93d0dbe627dec1c1
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
ap...@google.com <ap...@google.com> #17
Branch: 8.2
commit fe9c21581262cb92258d217c1c4f52a652e64d4d
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 13:48:00 2024
Reland "Disable redundant load elimination in debug mode"
Notice: this cherry pick is written manually as this branch is from
before the introduction of code rewriter passes.
Bug:
Bug:
Change-Id: I1c4fba711609183130735f8b93d0dbe627dec1c1
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
ap...@google.com <ap...@google.com> #18
Branch: 8.2
commit fd4b26bdc8af1f07472da2af2114e027e53a0efc
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 13:50:35 2024
Version 8.2.46
Bug:
Change-Id: I880c56fd07902c4697105778150be4cc16cd27a6
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #19
Branch: 8.1
commit 59a7c1ac06e0fed85dd2f4f2a710f11fe433640b
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 12:13:37 2024
Reland "Disable redundant load elimination in debug mode"
Notice: this cherry pick is written manually as this branch is from
before the introduction of code rewriter passes.
Bug:
Bug:
Change-Id: I1c4fba711609183130735f8b93d0dbe627dec1c1
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
ap...@google.com <ap...@google.com> #20
Branch: 8.1
commit 916a6d04b1c84a95bca923f2ea273fd7d52532fa
Author: Ian Zerny <zerny@google.com>
Date: Tue Jan 09 12:14:41 2024
Version 8.1.78
Bug:
Change-Id: I00bd2fac3a2548883838209d239b7fd200a54da0
M src/main/java/com/android/tools/r8/Version.java
ze...@google.com <ze...@google.com> #21
A fix has been pushed to 8.0, 8.1, 8.2 and 8.3 branches for R8.
To use one of the fixed versions without AGP updates amend your settings.gradle
or settings.gradle.kts
file with:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.2.46") // <-- Use version matching your AGP here
}
}
}
Since AGP 8, the R8 versions follow those of AGP, so if using AGP 8.2 use the latest version on the R8 8.2 branch (for this
ms...@gmail.com <ms...@gmail.com> #22
Thank you for fixing this issue!
an...@google.com <an...@google.com> #23
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Hedgehog | 2023.1.1 Patch 2
- Android Gradle Plugin 8.2.2
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
so...@google.com <so...@google.com> #24
Comment added by automation: A postmortem has been automatically requested for this issue. Please author a postmortem on IRM. See go/android-postmortem-guidance for more context and details, including how to handle the case when this issue does not need a postmortem. If you have any questions not answered by go/android-postmortem-guidance, please email android-hygiene-tpm@, instead of reassigning the fixed bug. Thank you.
an...@google.com <an...@google.com> #25
The fixes for this issue are now also available in:
- Android Studio Iguana | 2023.2.1 RC 1
- Android Gradle Plugin 8.3.0-rc01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
I work on the WALA static analysis framework (https://github.com/wala/WALA ), and we use D8 to test WALA's Dalvik frontend. I've been trying to update to the latest D8 version and I ran into an issue with unexpected dead code elimination. Consider the following (weird) Java code from JLex:
With the old D8 version we were using (2.2.42), the
System.out.println
calls would be present in the Dalvik bytecode output of D8, even though they are clearly dead code. But with verson 8.2.39, these calls are eliminated. I wouldn't expect D8 alone to be doing this optimization. Here is how we run D8 on a jar:Is the new output expected? I.e., is this level of dead code elimination now "baked in" to D8? Thanks!