mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 20:56:06 +00:00

Previously treatment of the attribute `optnone` was modified in https://github.com/llvm/llvm-project/pull/85605 ([clang] Set correct FPOptions if attribute 'optnone' presents). As a side effect FPContract was disabled for optnone. It created unneeded divergence with the behavior of -O0, which enables this optimization. In the discussion https://github.com/llvm/llvm-project/pull/85605#issuecomment-2089350379 it was pointed out that FP contraction should be enabled even if all optimizations are turned off, otherwise results of calculations would be different. This change enables FPContract at optnone.
30 lines
978 B
Objective-C
30 lines
978 B
Objective-C
// Test without serialization:
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux -ast-dump %s \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
|
|
// Test with serialization:
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -x objective-c -triple x86_64-pc-linux -include-pch %t -ast-dump-all /dev/null \
|
|
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
|
|
|
|
@interface Adder
|
|
- (float) sum: (float)x with: (float)y __attribute((optnone));
|
|
@end
|
|
|
|
#pragma float_control(precise, off)
|
|
|
|
@implementation Adder
|
|
- (float) sum: (float)x with: (float)y __attribute((optnone)) {
|
|
return x + y;
|
|
}
|
|
|
|
@end
|
|
|
|
// CHECK-LABEL: ObjCImplementationDecl {{.*}} Adder
|
|
// CHECK: ObjCMethodDecl {{.*}} - sum:with: 'float'
|
|
// CHECK: CompoundStmt {{.*}} FPContractMode=1 MathErrno=1
|
|
// CHECK-NEXT: ReturnStmt
|
|
// CHECK-NEXT: BinaryOperator {{.*}} 'float' '+' FPContractMode=1 MathErrno=1
|