Skip to content

Commit c1814f0

Browse files
committed
Review changes
* Use constexpr std::array instead of inline const SmallVector. * shouldExpandFremType - Remove LibCall action handling - Add assert to document that vectors are not handled - additionally: Inline variable
1 parent 0a30d40 commit c1814f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/CodeGen/ExpandFp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ class FRemExpander {
7777
/// The frem argument/return types that can be expanded by this class.
7878
// TODO The expansion could work for other floating point types
7979
// as well, but this would require additional testing.
80-
inline static const SmallVector<MVT, 3> ExpandableTypes{MVT::f16, MVT::f32,
81-
MVT::f64};
80+
static constexpr std::array<MVT, 3> ExpandableTypes{MVT::f16, MVT::f32,
81+
MVT::f64};
8282

8383
/// Libcalls for frem instructions of the type at the corresponding
8484
/// positions of ExpandableTypes.
85-
inline static const SmallVector<RTLIB::Libcall, 3> FremLibcalls{
85+
static constexpr std::array<RTLIB::Libcall, 3> FremLibcalls{
8686
RTLIB::REM_F32, RTLIB::REM_F32, RTLIB::REM_F64};
8787

8888
/// Return the Libcall for frem instructions of expandable type \p VT or
@@ -108,14 +108,14 @@ class FRemExpander {
108108
/// should happen if the legalization for the scalar type uses a
109109
/// non-existing libcall.
110110
static bool shouldExpandFremType(const TargetLowering &TLI, EVT VT) {
111+
assert(!VT.isVector() && "Cannot handle vector type; must scalarize first");
112+
111113
TargetLowering::LegalizeAction LA = TLI.getOperationAction(ISD::FREM, VT);
112-
if (LA != TargetLowering::LegalizeAction::LibCall &&
113-
LA != TargetLowering::LegalizeAction::Expand)
114+
if (LA != TargetLowering::LegalizeAction::Expand)
114115
return false;
115116

116117
auto Libcall = getFremLibcallForType(VT);
117-
bool MissingLibcall = Libcall.has_value() && !TLI.getLibcallName(*Libcall);
118-
return MissingLibcall;
118+
return Libcall.has_value() && !TLI.getLibcallName(*Libcall);;
119119
}
120120

121121
static bool shouldExpandFremType(const TargetLowering &TLI, Type *Ty) {

0 commit comments

Comments
 (0)