diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-08-02 13:32:27 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-08-02 13:32:27 -0700 |
commit | 39bd1f66ebd83185944cf08903d8abf80321c17d (patch) | |
tree | f24f67d037a3f3a989b822f9413bcf1e5ef56c86 /test | |
parent | 0fdd44084de8589343b099a4d1908f221e7bdc37 (diff) |
Remove unnecessary pointer casts on store instructions.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/21964002
Diffstat (limited to 'test')
-rw-r--r-- | test/NaCl/Bitcode/bitcast-elide.ll | 34 | ||||
-rw-r--r-- | test/NaCl/Bitcode/inttoptr-elide.ll | 37 |
2 files changed, 67 insertions, 4 deletions
diff --git a/test/NaCl/Bitcode/bitcast-elide.ll b/test/NaCl/Bitcode/bitcast-elide.ll index 1c4e2e6e29..37c19fb94c 100644 --- a/test/NaCl/Bitcode/bitcast-elide.ll +++ b/test/NaCl/Bitcode/bitcast-elide.ll @@ -210,4 +210,36 @@ define i32 @TwoLoadOpt(i32 %i) { ; PF2-NEXT: <INST_LOAD abbrevid=4 op0=3 op1=3 op2=0 op3=0/> ; PF2-NEXT: <INST_BINOP abbrevid=5 op0=2 op1=1 op2=0/> ; PF2-NEXT: <INST_RET abbrevid=9 op0=1/> -; PF2: </FUNCTION_BLOCK> +; PF2: </FUNCTION_BLOCK> + +; Test that we elide the simple case of bitcast for a store. +define void @SimpleStore(i32 %i) { + %1 = bitcast [7 x i8]* @bytes to i32* + store i32 %i, i32* %1, align 4 + ret void +} + +; TD1: define void @SimpleStore(i32 %i) { +; TD1-NEXT: %1 = bitcast [7 x i8]* @bytes to i32* +; TD1-NEXT: store i32 %i, i32* %1, align 4 +; TD1-NEXT: ret void +; TD1-NEXT: } + +; PF1: <FUNCTION_BLOCK NumWords=6 BlockCodeSize=4> +; PF1-NEXT: <DECLAREBLOCKS op0=1/> +; PF1-NEXT: <INST_CAST abbrevid=7 op0=2 op1=1 op2=11/> +; PF1-NEXT: <INST_STORE abbrevid=12 op0=1 op1=2 op2=3 op3=0/> +; PF1-NEXT: <INST_RET abbrevid=8/> +; PF1: </FUNCTION_BLOCK> + +; TD2: define void @SimpleStore(i32 %i) { +; TD2-NEXT: %1 = bitcast [7 x i8]* @bytes to i32* +; TD2-NEXT: store i32 %i, i32* %1, align 4 +; TD2-NEXT: ret void +; TD2-NEXT: } + +; PF2: <FUNCTION_BLOCK NumWords=5 BlockCodeSize=4> +; PF2-NEXT: <DECLAREBLOCKS op0=1/> +; PF2-NEXT: <INST_STORE abbrevid=12 op0=2 op1=1 op2=3 op3=0/> +; PF2-NEXT: <INST_RET abbrevid=8/> +; PF2: </FUNCTION_BLOCK> diff --git a/test/NaCl/Bitcode/inttoptr-elide.ll b/test/NaCl/Bitcode/inttoptr-elide.ll index 2f35389fa5..988e16ea7b 100644 --- a/test/NaCl/Bitcode/inttoptr-elide.ll +++ b/test/NaCl/Bitcode/inttoptr-elide.ll @@ -174,7 +174,38 @@ define i32 @TwoLoadOpt(i32 %i) { ; PF2-NEXT: <INST_LOAD abbrevid=4 op0=2 op1=3 op2=0 op3=0/> ; PF2-NEXT: <INST_BINOP abbrevid=5 op0=2 op1=1 op2=0/> ; PF2-NEXT: <INST_RET abbrevid=9 op0=1/> -; PF2-NEXT: <VALUE_SYMTAB NumWords=1 BlockCodeSize=3> -; PF2-NEXT: <ENTRY abbrevid=6 op0=4 op1=105/> -; PF2-NEXT: </VALUE_SYMTAB> ; PF2: </FUNCTION_BLOCK> + +; ------------------------------------------------------ + +; Test that we elide the simple case of inttoptr for a store. +define void @SimpleStore(i32 %i) { + %1 = inttoptr i32 %i to i32* + store i32 %i, i32* %1, align 4 + ret void +} + +; TD1: define void @SimpleStore(i32 %i) { +; TD1-NEXT: %1 = inttoptr i32 %i to i32* +; TD1-NEXT: store i32 %i, i32* %1, align 4 +; TD1-NEXT: ret void +; TD1-NEXT: } + +; PF1: <FUNCTION_BLOCK NumWords=6 BlockCodeSize=4> +; PF1-NEXT: <DECLAREBLOCKS op0=1/> +; PF1-NEXT: <INST_CAST abbrevid=7 op0=1 op1=1 op2=10/> +; PF1-NEXT: <INST_STORE abbrevid=12 op0=1 op1=2 op2=3 op3=0/> +; PF1-NEXT: <INST_RET abbrevid=8/> +; PF1: </FUNCTION_BLOCK> + +; TD2: define void @SimpleStore(i32 %i) { +; TD2-NEXT: %1 = inttoptr i32 %i to i32* +; TD2-NEXT: store i32 %i, i32* %1, align 4 +; TD2-NEXT: ret void +; TD2-NEXT: } + +; PF2: <FUNCTION_BLOCK NumWords=5 BlockCodeSize=4> +; PF2-NEXT: <DECLAREBLOCKS op0=1/> +; PF2-NEXT: <INST_STORE abbrevid=12 op0=1 op1=1 op2=3 op3=0/> +; PF2-NEXT: <INST_RET abbrevid=8/> +; PF2T: </FUNCTION_BLOCK> |