From 6b8a6b50d91d625c15497bd400a537e4526e0179 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 11 Apr 2007 19:54:37 +0000 Subject: [PATCH] Add a test case for testing basic IR features via llvm2cpp. This helps find bit rot in llvm2cpp and also tests the LLVM C++ IR in ways that llvm-as doesn't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35917 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Feature/llvm2cpp.ll | 795 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 795 insertions(+) create mode 100644 test/Feature/llvm2cpp.ll diff --git a/test/Feature/llvm2cpp.ll b/test/Feature/llvm2cpp.ll new file mode 100644 index 00000000000..523d8697931 --- /dev/null +++ b/test/Feature/llvm2cpp.ll @@ -0,0 +1,795 @@ +; RUN: llvm-as < %s | llvm-dis > %t1.ll +; RUN: llvm-as < %s | llvm2cpp -gen-program -o %t2.cpp - +; RUN: gcc -g -D__STDC_LIMIT_MACROS -o %t2.exe %t2.cpp -I%I -L%L -lLLVMCore -lLLVMSupport -lLLVMbzip2 -lLLVMSystem -lstdc++ +; RUN: %t2.exe > %t2.ll +; RUN: diff %t1.ll %t2.ll + +@X = global i32 4, align 16 ; [#uses=0] + +define i32* @test1012() align 32 { + %X = alloca i32, align 4 ; [#uses=1] + %Y = alloca i32, i32 42, align 16 ; [#uses=0] + %Z = alloca i32 ; [#uses=0] + ret i32* %X +} + +define i32* @test1013() { + %X = malloc i32, align 4 ; [#uses=1] + %Y = malloc i32, i32 42, align 16 ; [#uses=0] + %Z = malloc i32 ; [#uses=0] + ret i32* %X +} + +define void @void(i32, i32) { + add i32 0, 0 ; :3 [#uses=2] + sub i32 0, 4 ; :4 [#uses=2] + br label %5 + +;