Index: llvm/include/llvm/IR/Intrinsics.td =================================================================== --- llvm/include/llvm/IR/Intrinsics.td +++ llvm/include/llvm/IR/Intrinsics.td @@ -710,6 +710,9 @@ def int_roundeven : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>; def int_canonicalize : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>; + // Arithmetic fence intrinsic. + def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], + [IntrNoMem]>; def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>; def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>; @@ -757,7 +760,7 @@ def int_is_fpclass : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>], [llvm_anyfloat_ty, llvm_i32_ty], - [IntrNoMem, IntrWillReturn, ImmArg>]>; + [IntrNoMem, IntrWillReturn, IntrSpeculatable, ImmArg>]>; //===--------------- Constrained Floating Point Intrinsics ----------------===// // @@ -1389,9 +1392,6 @@ def int_pseudoprobe : DefaultAttrsIntrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty, llvm_i64_ty], [IntrInaccessibleMemOnly, IntrWillReturn]>; -// Arithmetic fence intrinsic. -def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>; - // Intrinsics to support half precision floating point format let IntrProperties = [IntrNoMem, IntrWillReturn] in { def int_convert_to_fp16 : DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_anyfloat_ty]>; Index: llvm/test/Transforms/SpeculativeExecution/spec-calls.ll =================================================================== --- llvm/test/Transforms/SpeculativeExecution/spec-calls.ll +++ llvm/test/Transforms/SpeculativeExecution/spec-calls.ll @@ -62,3 +62,34 @@ b: ret void } + +; CHECK-LABEL: @ifThen_fpclass( +; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11) +; CHECK-NEXT: br i1 true +define void @ifThen_fpclass(float %x) { + br i1 true, label %a, label %b + +a: + %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11) + br label %b + +b: + ret void +} + +; CHECK-LABEL: @ifThen_arithmetic_fence( +; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11) +; CHECK-NEXT: br i1 true +define void @ifThen_arithmetic_fence(float %x) { + br i1 true, label %a, label %b + +a: + %canon = call float @llvm.arithmetic.fence.f32(float %x) + br label %b + +b: + ret void +} + +declare i1 @llvm.is.fpclass.f32(float, i32) +declare float @llvm.arithmetic.fence.f32(float)