llvm-project/clang/test/CodeGen/windows-seh-abnormal-exits.c
hyeongyu kim 1b1c8d83d3 [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.

Test updates are made as a separate patch: D108453

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D105169
2022-01-16 18:54:17 +09:00

31 lines
964 B
C

// RUN: %clang_cc1 -triple x86_64-windows -fms-extensions -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s
// CHECK: %[[src:[0-9-]+]] = call i8* @llvm.localaddress()
// CHECK-NEXT: %cleanup.dest = load i32, i32* %cleanup.dest.slot, align 4
// CHECK-NEXT: %[[src2:[0-9-]+]] = icmp ne i32 %cleanup.dest, 0
// CHECK-NEXT: %[[src3:[0-9-]+]] = zext i1 %[[src2]] to i8
// CHECK-NEXT: call void @"?fin$0@0@seh_abnormal_exits@@"(i8 noundef %[[src3]], i8* noundef %[[src]])
void seh_abnormal_exits(int *Counter) {
for (int i = 0; i < 5; i++) {
__try {
if (i == 0)
continue; // abnormal termination
else if (i == 1)
goto t10; // abnormal termination
else if (i == 2)
__leave; // normal execution
else if (i == 4)
return; // abnormal termination
}
__finally {
if (AbnormalTermination()) {
*Counter += 1;
}
}
t10:;
}
return; // *Counter == 3
}