diff options
author | Vladimir Marko <vmarko@google.com> | 2015-06-19 12:58:22 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2015-06-19 16:04:59 +0100 |
commit | 9f7687cb5c1390ec4bcc2f8fa10dbee33aff3d6a (patch) | |
tree | 91334d4d07517d7da1aab4c46b47649ae791c88b /test/800-smali | |
parent | dd3c7d2d6124ceb346b4ed9aa7115f75fc6d3f9f (diff) | |
download | art-9f7687cb5c1390ec4bcc2f8fa10dbee33aff3d6a.zip art-9f7687cb5c1390ec4bcc2f8fa10dbee33aff3d6a.tar.gz art-9f7687cb5c1390ec4bcc2f8fa10dbee33aff3d6a.tar.bz2 |
Quick: Fix optimizations for empty if blocks.
If a block ending with if-eqz or if-nez has the same "taken"
and "fallthrough", we cannot assume that the value has been
checked against zero in one of the succesors. This affects
the null check elimination pass as well as GVN. Refactor all
those checks to a single function in BasicBlock and check
that the "taken" and "falthrough" are different when needed.
Bug: 21614284
(cherry picked from commit f11c420c448baffac6a70ac0884d481ab347e257)
Change-Id: I062e0042de3470ce8680b586487b9c7acbd206bc
Diffstat (limited to 'test/800-smali')
-rw-r--r-- | test/800-smali/expected.txt | 1 | ||||
-rw-r--r-- | test/800-smali/smali/b_21614284.smali | 22 | ||||
-rw-r--r-- | test/800-smali/src/Main.java | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index c5728b5..e2075da 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -17,4 +17,5 @@ MoveExceptionOnEntry EmptySparseSwitch b/20224106 b/21873167 +b/21614284 Done! diff --git a/test/800-smali/smali/b_21614284.smali b/test/800-smali/smali/b_21614284.smali new file mode 100644 index 0000000..3cb1bd0 --- /dev/null +++ b/test/800-smali/smali/b_21614284.smali @@ -0,0 +1,22 @@ +.class public LB21614284; +.super Ljava/lang/Object; + +.field private a:I + +.method public constructor <init>()V + .registers 2 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + const v0, 42 + iput v0, p0, LB21614284;->a:I + return-void +.end method + +.method public static test(LB21614284;)I + .registers 2 + # Empty if, testing p0. + if-nez p0, :label + :label + # p0 still needs a null check. + iget v0, p0, LB21614284;->a:I + return v0 +.end method diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index 7196de1..4c6da63 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -82,6 +82,8 @@ public class Main { testCases.add(new TestCase("b/20224106", "B20224106", "run", null, new VerifyError(), 0)); testCases.add(new TestCase("b/21873167", "B21873167", "test", null, null, null)); + testCases.add(new TestCase("b/21614284", "B21614284", "test", new Object[] { null }, + new NullPointerException(), null)); } public void runTests() { |