Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: test/NaCl/Bitcode/inttoptr-of-ptrtoint-elide.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/NaCl/Bitcode/inttoptr-elide.ll ('k') | test/NaCl/Bitcode/lit.local.cfg » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/Bitcode/inttoptr-of-ptrtoint-elide.ll
diff --git a/test/NaCl/Bitcode/inttoptr-of-ptrtoint-elide.ll b/test/NaCl/Bitcode/inttoptr-of-ptrtoint-elide.ll
new file mode 100644
index 0000000000000000000000000000000000000000..1d88ca5cd96c88ccda3ff23ad6e68643e5d8d4c4
--- /dev/null
+++ b/test/NaCl/Bitcode/inttoptr-of-ptrtoint-elide.ll
@@ -0,0 +1,32 @@
+; Test that the writer elides an inttoptr of a ptrtoint.
+
+; RUN: llvm-as < %s | pnacl-freeze \
+; RUN: | pnacl-bcanalyzer -dump-records \
+; RUN: | FileCheck %s -check-prefix=PF2
+
+; RUN: llvm-as < %s | pnacl-freeze | pnacl-thaw \
+; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD2
+
+
+@bytes = internal global [4 x i8] c"abcd"
+
+define void @inttoptr_of_ptrtoint() {
+ ; These two instructions are usually replaced with an equivalent
+ ; bitcast, but either sequence is allowed by the PNaCl ABI verifier.
+ %1 = ptrtoint [4 x i8]* @bytes to i32
+ %2 = inttoptr i32 %1 to i8*
+ load i8* %2
+ ret void
+}
+
+; TD2: define void @inttoptr_of_ptrtoint() {
+; TD2-NEXT: %1 = bitcast [4 x i8]* @bytes to i8*
+; TD2-NEXT: %2 = load i8* %1
+; TD2-NEXT: ret void
+; TD2-NEXT: }
+
+; PF2: <FUNCTION_BLOCK>
+; PF2-NEXT: <DECLAREBLOCKS op0=1/>
+; PF2-NEXT: <INST_LOAD {{.*}}/>
+; PF2-NEXT: <INST_RET/>
+; PF2: </FUNCTION_BLOCK>
« no previous file with comments | « test/NaCl/Bitcode/inttoptr-elide.ll ('k') | test/NaCl/Bitcode/lit.local.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698