Skip to content

Commit ab38087

Browse files
committed
add two more test subjects
1 parent bdd147f commit ab38087

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

cmake/phasar_macros.cmake

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function(add_phasar_unittest test_name)
5050
endfunction()
5151

5252
function(generate_ll_file)
53-
set(options MEM2REG DEBUG)
53+
set(options MEM2REG DEBUG O1 O2 O3)
5454
set(testfile FILE)
5555
cmake_parse_arguments(GEN_LL "${options}" "${testfile}" "" ${ARGN} )
5656
# get file extension
@@ -92,6 +92,21 @@ function(generate_ll_file)
9292
list(APPEND GEN_C_FLAGS -g)
9393
set(GEN_CMD_COMMENT "${GEN_CMD_COMMENT}[DBG]")
9494
endif()
95+
if(GEN_LL_O1)
96+
list(APPEND GEN_CXX_FLAGS -O1)
97+
list(APPEND GEN_C_FLAGS -O1)
98+
set(GEN_CMD_COMMENT "${GEN_CMD_COMMENT}[O1]")
99+
endif()
100+
if(GEN_LL_O2)
101+
list(APPEND GEN_CXX_FLAGS -O2)
102+
list(APPEND GEN_C_FLAGS -O2)
103+
set(GEN_CMD_COMMENT "${GEN_CMD_COMMENT}[O2]")
104+
endif()
105+
if(GEN_LL_03)
106+
list(APPEND GEN_CXX_FLAGS -O3)
107+
list(APPEND GEN_C_FLAGS -O3)
108+
set(GEN_CMD_COMMENT "${GEN_CMD_COMMENT}[O3]")
109+
endif()
95110
set(GEN_CMD_COMMENT "${GEN_CMD_COMMENT} ${GEN_LL_FILE}")
96111

97112
# define .ll file generation command

test/llvm_test_code/inst_interaction/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ set(Sources
2424
struct_01.cpp
2525
)
2626

27+
set(SourceOpt
28+
global_03.cpp
29+
global_04.cpp
30+
)
31+
2732
foreach(TEST_SRC ${Sources})
2833
generate_ll_file(FILE ${TEST_SRC})
2934
endforeach(TEST_SRC)
35+
36+
foreach(TEST_SRC ${SourcesOpt})
37+
generate_ll_file(FILE ${TEST_SRC} O1)
38+
endforeach(TEST_SRC)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
int GlobalFeature = 2;
2+
3+
int main(int argc, char *argv[]) {
4+
int Sum = argc;
5+
6+
switch (GlobalFeature + argc) {
7+
case 0:
8+
return 21;
9+
case 1:
10+
Sum += 2;
11+
case 7:
12+
Sum += 3;
13+
break;
14+
case 2:
15+
Sum += 4;
16+
break;
17+
case 4:
18+
Sum += 4;
19+
break;
20+
}
21+
22+
Sum += 42;
23+
24+
return Sum;
25+
}

test/llvm_test_code/inst_interaction/global_04.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)