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

Unified Diff: tests_lit/llvm2ice_tests/mangle.ll

Issue 265703002: Add Om1 lowering with no optimizations (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Merge changed from Karl's committed CL Created 6 years, 7 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 | « tests_lit/llvm2ice_tests/load.ll ('k') | tests_lit/llvm2ice_tests/return-int-arg.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/mangle.ll
diff --git a/tests_lit/llvm2ice_tests/mangle.ll b/tests_lit/llvm2ice_tests/mangle.ll
new file mode 100644
index 0000000000000000000000000000000000000000..c76a23d1179a6bf960976949f7fb7e8d241f59dd
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/mangle.ll
@@ -0,0 +1,105 @@
+; Tests the Subzero "name mangling" when using the "llvm2ice --prefix"
+; option.
+
+; RUN: %llvm2ice --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none --prefix Subzero %s | FileCheck --check-prefix=MANGLE %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
+; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
+; RUN: | FileCheck --check-prefix=DUMP %s
+
+define internal void @FuncC(i32 %i) {
+entry:
+ ret void
+}
+; FuncC is a C symbol that isn't recognized as a C++ mangled symbol.
+; CHECK: FuncC:
+; MANGLE: SubzeroFuncC
+
+define internal void @_ZN13TestNamespace4FuncEi(i32 %i) {
+entry:
+ ret void
+}
+; This is Func(int) nested inside namespace TestNamespace.
+; CHECK: _ZN13TestNamespace4FuncEi:
+; MANGLE: _ZN7Subzero13TestNamespace4FuncEi:
+
+define internal void @_ZN13TestNamespace15NestedNamespace4FuncEi(i32 %i) {
+entry:
+ ret void
+}
+; This is Func(int) nested inside two namespaces.
+; CHECK: _ZN13TestNamespace15NestedNamespace4FuncEi:
+; MANGLE: _ZN7Subzero13TestNamespace15NestedNamespace4FuncEi:
+
+define internal void @_Z13FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; This is a non-nested, mangled C++ symbol.
+; CHECK: _Z13FuncCPlusPlusi:
+; MANGLE: _ZN7Subzero13FuncCPlusPlusEi:
+
+define internal void @_ZN12_GLOBAL__N_18FuncAnonEi(i32 %i) {
+entry:
+ ret void
+}
+; This is FuncAnon(int) nested inside an anonymous namespace.
+; CHECK: _ZN12_GLOBAL__N_18FuncAnonEi:
+; MANGLE: _ZN7Subzero12_GLOBAL__N_18FuncAnonEi:
+
+; Now for the illegitimate examples.
+
+; Test for _ZN with no suffix. Don't crash, prepend Subzero.
+define internal void @_ZN(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_ZN:
+
+; Test for _Z<len><str> where <len> is smaller than it should be.
+define internal void @_Z12FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero12FuncCPlusPluEsi:
+
+; Test for _Z<len><str> where <len> is slightly larger than it should be.
+define internal void @_Z14FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero14FuncCPlusPlusiE:
+
+; Test for _Z<len><str> where <len> is much larger than it should be.
+define internal void @_Z114FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z114FuncCPlusPlusi:
+
+; Test for _Z<len><str> where we try to overflow the uint32_t holding <len>.
+define internal void @_Z4294967296FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z4294967296FuncCPlusPlusi:
+
+; Test for _Z<len><str> where <len> is 0.
+define internal void @_Z0FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero0EFuncCPlusPlusi:
+
+; Test for _Z<len><str> where <len> is -1. LLVM explicitly allows the
+; '-' character in identifiers.
+
+define internal void @_Z-1FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z-1FuncCPlusPlusi:
+
+; ERRORS-NOT: ICE translation error
+; DUMP-NOT: SZ
« no previous file with comments | « tests_lit/llvm2ice_tests/load.ll ('k') | tests_lit/llvm2ice_tests/return-int-arg.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698