Files
clang-p2996/bolt/test/X86/Inputs/inlined.cpp
Amir Ayupov 92e306de0c [BOLT][TEST] Imported small tests
Summary:
Imported small internal tests:
- indirect_goto.test
- indirect_goto_pie.test
- inlined_function_mixed.test

(cherry picked from FBD31446571)
2021-10-06 12:23:05 -07:00

24 lines
541 B
C++

extern "C" int printf(const char*, ...);
extern const char* question();
inline int answer() __attribute__((always_inline));
inline int answer() { return 42; }
int main(int argc, char *argv[]) {
int ans;
if (argc == 1) {
ans = 0;
} else {
ans = argc;
}
printf("%s\n", question());
for (int i = 0; i < 10; ++i) {
int x = answer();
int y = answer();
ans += x - y;
}
// padding to make sure question() is inlineable
asm("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;");
return ans;
}