
Since the issue with trap value is fixed in D158191, it now should pass on both platforms. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D158899
40 lines
722 B
C++
40 lines
722 B
C++
// Test that we can have a statement that throws in hot cold
|
|
// and a landing pad in cold code.
|
|
//
|
|
// Record performance data with no args. Run test with 2 args.
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
int foo() { return 0; }
|
|
|
|
void bar(int a) {
|
|
if (a > 2 && a % 2)
|
|
throw new int();
|
|
}
|
|
|
|
void filter_only() { foo(); }
|
|
|
|
int main(int argc, char **argv) {
|
|
unsigned r = 0;
|
|
|
|
uint64_t limit = (argc >= 2 ? 10 : 5000);
|
|
for (uint64_t i = 0; i < limit; ++i) {
|
|
i += foo();
|
|
try {
|
|
bar(argc);
|
|
try {
|
|
if (argc >= 2)
|
|
throw new int();
|
|
} catch (...) {
|
|
printf("catch 2\n");
|
|
throw new int();
|
|
}
|
|
} catch (...) {
|
|
printf("catch 1\n");
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|