@@ -1043,7 +1043,7 @@ def int_experimental_memset_pattern
10431043// FIXME: Add version of these floating point intrinsics which allow non-default
10441044// rounding modes and FP exception handling.
10451045
1046- let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1046+ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ] in {
10471047 def int_fma : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
10481048 [LLVMMatchType<0>, LLVMMatchType<0>,
10491049 LLVMMatchType<0>]>;
@@ -1056,16 +1056,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
10561056 // environment so they can be treated as readnone.
10571057 def int_sqrt : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10581058 def int_powi : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_anyint_ty]>;
1059- def int_asin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1060- def int_acos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1061- def int_atan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1062- def int_atan2 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
10631059 def int_sin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10641060 def int_cos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1065- def int_tan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1066- def int_sinh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1067- def int_cosh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1068- def int_tanh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10691061 def int_pow : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
10701062 [LLVMMatchType<0>, LLVMMatchType<0>]>;
10711063 def int_log : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
@@ -1084,12 +1076,6 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
10841076 def int_nearbyint : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10851077 def int_round : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10861078 def int_roundeven : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1087- def int_sincos : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1088- [llvm_anyfloat_ty]>;
1089- def int_sincospi : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1090- [llvm_anyfloat_ty]>;
1091- def int_modf : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1092- [llvm_anyfloat_ty]>;
10931079
10941080 // Truncate a floating point number with a specific rounding mode
10951081 def int_fptrunc_round : DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ],
@@ -1101,6 +1087,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
11011087 def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
11021088 [IntrNoMem]>;
11031089
1090+ // If the value doesn't fit an unspecified value is returned (but this
1091+ // is not poison).
11041092 def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
11051093 def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
11061094 def int_lrint : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
@@ -1114,29 +1102,49 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
11141102 def int_frexp : DefaultAttrsIntrinsic<[llvm_anyfloat_ty, llvm_anyint_ty], [LLVMMatchType<0>]>;
11151103}
11161104
1105+ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1106+ // These functions do not read memory, but are sensitive to the
1107+ // rounding mode. LLVM purposely does not model changes to the FP
1108+ // environment so they can be treated as readnone.
1109+ def int_asin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1110+ def int_acos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1111+ def int_atan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1112+ def int_atan2 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
1113+ def int_tan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1114+ def int_sinh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1115+ def int_cosh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1116+ def int_tanh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1117+ def int_sincos : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1118+ [llvm_anyfloat_ty]>;
1119+ def int_sincospi : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1120+ [llvm_anyfloat_ty]>;
1121+ def int_modf : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
1122+ [llvm_anyfloat_ty]>;
1123+ }
1124+
11171125def int_minnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11181126 [LLVMMatchType<0>, LLVMMatchType<0>],
1119- [IntrNoMem, IntrSpeculatable, Commutative]
1127+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11201128>;
11211129def int_maxnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11221130 [LLVMMatchType<0>, LLVMMatchType<0>],
1123- [IntrNoMem, IntrSpeculatable, Commutative]
1131+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11241132>;
11251133def int_minimum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11261134 [LLVMMatchType<0>, LLVMMatchType<0>],
1127- [IntrNoMem, IntrSpeculatable, Commutative]
1135+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11281136>;
11291137def int_maximum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11301138 [LLVMMatchType<0>, LLVMMatchType<0>],
1131- [IntrNoMem, IntrSpeculatable, Commutative]
1139+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11321140>;
11331141def int_minimumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11341142 [LLVMMatchType<0>, LLVMMatchType<0>],
1135- [IntrNoMem, IntrSpeculatable, Commutative]
1143+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11361144>;
11371145def int_maximumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
11381146 [LLVMMatchType<0>, LLVMMatchType<0>],
1139- [IntrNoMem, IntrSpeculatable, Commutative]
1147+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison ]
11401148>;
11411149
11421150// Internal interface for object size checking
@@ -1168,7 +1176,7 @@ let IntrProperties = [IntrInaccessibleMemOnly] in {
11681176def int_is_fpclass
11691177 : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
11701178 [llvm_anyfloat_ty, llvm_i32_ty],
1171- [IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<1>>]>;
1179+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, ImmArg<ArgIndex<1>>]>;
11721180
11731181//===--------------- Constrained Floating Point Intrinsics ----------------===//
11741182//
@@ -1410,7 +1418,7 @@ def int_expect_with_probability : DefaultAttrsIntrinsic<[llvm_anyint_ty],
14101418//
14111419
14121420// None of these intrinsics accesses memory at all.
1413- let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1421+ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ] in {
14141422 def int_bswap: DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
14151423 def int_ctpop: DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
14161424 def int_bitreverse : DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
@@ -1526,7 +1534,7 @@ def int_adjust_trampoline : DefaultAttrsIntrinsic<
15261534//
15271535
15281536// Expose the carry flag from add operations on two integrals.
1529- let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1537+ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ] in {
15301538 def int_sadd_with_overflow : DefaultAttrsIntrinsic<[llvm_anyint_ty,
15311539 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
15321540 [LLVMMatchType<0>, LLVMMatchType<0>]>;
@@ -1552,16 +1560,16 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
15521560//
15531561def int_sadd_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
15541562 [LLVMMatchType<0>, LLVMMatchType<0>],
1555- [IntrNoMem, IntrSpeculatable, Commutative]>;
1563+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Commutative]>;
15561564def int_uadd_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
15571565 [LLVMMatchType<0>, LLVMMatchType<0>],
1558- [IntrNoMem, IntrSpeculatable, Commutative]>;
1566+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Commutative]>;
15591567def int_ssub_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
15601568 [LLVMMatchType<0>, LLVMMatchType<0>],
1561- [IntrNoMem, IntrSpeculatable]>;
1569+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
15621570def int_usub_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
15631571 [LLVMMatchType<0>, LLVMMatchType<0>],
1564- [IntrNoMem, IntrSpeculatable]>;
1572+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
15651573def int_sshl_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
15661574 [LLVMMatchType<0>, LLVMMatchType<0>],
15671575 [IntrNoMem, IntrSpeculatable]>;
@@ -1616,22 +1624,22 @@ def int_abs : DefaultAttrsIntrinsic<
16161624
16171625def int_smax : DefaultAttrsIntrinsic<
16181626 [llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
1619- [IntrNoMem, IntrSpeculatable]>;
1627+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
16201628def int_smin : DefaultAttrsIntrinsic<
16211629 [llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
1622- [IntrNoMem, IntrSpeculatable]>;
1630+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
16231631def int_umax : DefaultAttrsIntrinsic<
16241632 [llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
1625- [IntrNoMem, IntrSpeculatable]>;
1633+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
16261634def int_umin : DefaultAttrsIntrinsic<
16271635 [llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
1628- [IntrNoMem, IntrSpeculatable]>;
1636+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
16291637def int_scmp : DefaultAttrsIntrinsic<
16301638 [llvm_anyint_ty], [llvm_anyint_ty, LLVMMatchType<1>],
1631- [IntrNoMem, IntrSpeculatable, Range<RetIndex, -1, 2>]>;
1639+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Range<RetIndex, -1, 2>]>;
16321640def int_ucmp : DefaultAttrsIntrinsic<
16331641 [llvm_anyint_ty], [llvm_anyint_ty, LLVMMatchType<1>],
1634- [IntrNoMem, IntrSpeculatable, Range<RetIndex, -1, 2>]>;
1642+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Range<RetIndex, -1, 2>]>;
16351643
16361644//===------------------------- Memory Use Markers -------------------------===//
16371645//
@@ -1873,7 +1881,7 @@ def int_convert_from_fp16 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [llvm_i16_
18731881}
18741882
18751883// Saturating floating point to integer intrinsics
1876- let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1884+ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ] in {
18771885def int_fptoui_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
18781886def int_fptosi_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
18791887}
@@ -1896,7 +1904,7 @@ def int_fake_use : DefaultAttrsIntrinsic<[], [llvm_vararg_ty],
18961904// First argument must be pointer or vector of pointer. This is checked by the
18971905// verifier.
18981906def int_ptrmask: DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>, llvm_anyint_ty],
1899- [IntrNoMem, IntrSpeculatable]>;
1907+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison ]>;
19001908
19011909// Intrinsic to wrap a thread local variable.
19021910def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>],
0 commit comments