@@ -1072,7 +1072,7 @@ void llvm::getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU) {
1072
1072
1073
1073
LLT llvm::getLCMType (LLT OrigTy, LLT TargetTy) {
1074
1074
if (OrigTy.getSizeInBits () == TargetTy.getSizeInBits ())
1075
- return OrigTy;
1075
+ return OrigTy;
1076
1076
1077
1077
if (OrigTy.isVector () && TargetTy.isVector ()) {
1078
1078
LLT OrigElt = OrigTy.getElementType ();
@@ -1090,57 +1090,54 @@ LLT llvm::getLCMType(LLT OrigTy, LLT TargetTy) {
1090
1090
" getLCMType not implemented between fixed and scalable vectors." );
1091
1091
1092
1092
if (OrigElt.getSizeInBits () == TargetElt.getSizeInBits ()) {
1093
- int GCDMinElts =
1094
- std::gcd (OrigTy.getElementCount ().getKnownMinValue (),
1095
- TargetTy.getElementCount ().getKnownMinValue ());
1093
+ int GCDMinElts = std::gcd (OrigTy.getElementCount ().getKnownMinValue (),
1094
+ TargetTy.getElementCount ().getKnownMinValue ());
1096
1095
// Prefer the original element type.
1097
1096
ElementCount Mul = OrigTy.getElementCount ().multiplyCoefficientBy (
1098
1097
TargetTy.getElementCount ().getKnownMinValue ());
1099
1098
return LLT::vector (Mul.divideCoefficientBy (GCDMinElts),
1100
1099
OrigTy.getElementType ());
1101
1100
}
1102
1101
unsigned LCM = std::lcm (OrigTy.getElementCount ().getKnownMinValue () *
1103
- OrigElt.getSizeInBits ().getFixedValue (),
1104
- TargetTy.getElementCount ().getKnownMinValue () *
1105
- TargetElt.getSizeInBits ().getFixedValue ());
1102
+ OrigElt.getSizeInBits ().getFixedValue (),
1103
+ TargetTy.getElementCount ().getKnownMinValue () *
1104
+ TargetElt.getSizeInBits ().getFixedValue ());
1106
1105
return LLT::vector (
1107
1106
ElementCount::get (LCM / OrigElt.getSizeInBits (), OrigTy.isScalable ()),
1108
1107
OrigElt);
1109
1108
}
1110
1109
1111
- // One type is scalar, one type is vector
1112
- if (OrigTy.isVector () || TargetTy.isVector ()) {
1113
- LLT VecTy = OrigTy.isVector () ? OrigTy : TargetTy;
1114
- LLT ScalarTy = OrigTy.isVector () ? TargetTy : OrigTy;
1115
- LLT EltTy = VecTy.getElementType ();
1116
- LLT OrigEltTy = OrigTy.isVector () ? OrigTy.getElementType () : OrigTy;
1117
-
1118
- // Prefer scalar type from OrigTy.
1119
- if (EltTy.getSizeInBits () == ScalarTy.getSizeInBits ())
1120
- return LLT::vector (VecTy.getElementCount (), OrigEltTy);
1121
-
1122
- // Different size scalars. Create vector with the same total size.
1123
- // LCM will take fixed/scalable from VecTy.
1124
- unsigned LCM =
1125
- std::lcm (EltTy.getSizeInBits ().getFixedValue () *
1126
- VecTy.getElementCount ().getKnownMinValue (),
1127
- ScalarTy.getSizeInBits ().getFixedValue ());
1128
- // Prefer type from OrigTy
1129
- return LLT::vector (
1130
- ElementCount::get (LCM / OrigEltTy.getSizeInBits (),
1131
- VecTy.getElementCount ().isScalable ()),
1132
- OrigEltTy);
1133
- }
1134
-
1135
- // At this point, both types are scalars of different size
1136
- unsigned LCM = std::lcm (OrigTy.getSizeInBits ().getFixedValue (),
1137
- TargetTy.getSizeInBits ().getFixedValue ());
1138
- // Preserve pointer types.
1139
- if (LCM == OrigTy.getSizeInBits ())
1140
- return OrigTy;
1141
- if (LCM == TargetTy.getSizeInBits ())
1142
- return TargetTy;
1143
- return LLT::scalar (LCM);
1110
+ // One type is scalar, one type is vector
1111
+ if (OrigTy.isVector () || TargetTy.isVector ()) {
1112
+ LLT VecTy = OrigTy.isVector () ? OrigTy : TargetTy;
1113
+ LLT ScalarTy = OrigTy.isVector () ? TargetTy : OrigTy;
1114
+ LLT EltTy = VecTy.getElementType ();
1115
+ LLT OrigEltTy = OrigTy.isVector () ? OrigTy.getElementType () : OrigTy;
1116
+
1117
+ // Prefer scalar type from OrigTy.
1118
+ if (EltTy.getSizeInBits () == ScalarTy.getSizeInBits ())
1119
+ return LLT::vector (VecTy.getElementCount (), OrigEltTy);
1120
+
1121
+ // Different size scalars. Create vector with the same total size.
1122
+ // LCM will take fixed/scalable from VecTy.
1123
+ unsigned LCM = std::lcm (EltTy.getSizeInBits ().getFixedValue () *
1124
+ VecTy.getElementCount ().getKnownMinValue (),
1125
+ ScalarTy.getSizeInBits ().getFixedValue ());
1126
+ // Prefer type from OrigTy
1127
+ return LLT::vector (ElementCount::get (LCM / OrigEltTy.getSizeInBits (),
1128
+ VecTy.getElementCount ().isScalable ()),
1129
+ OrigEltTy);
1130
+ }
1131
+
1132
+ // At this point, both types are scalars of different size
1133
+ unsigned LCM = std::lcm (OrigTy.getSizeInBits ().getFixedValue (),
1134
+ TargetTy.getSizeInBits ().getFixedValue ());
1135
+ // Preserve pointer types.
1136
+ if (LCM == OrigTy.getSizeInBits ())
1137
+ return OrigTy;
1138
+ if (LCM == TargetTy.getSizeInBits ())
1139
+ return TargetTy;
1140
+ return LLT::scalar (LCM);
1144
1141
}
1145
1142
1146
1143
LLT llvm::getCoverTy (LLT OrigTy, LLT TargetTy) {
@@ -1158,7 +1155,6 @@ LLT llvm::getCoverTy(LLT OrigTy, LLT TargetTy) {
1158
1155
OrigTy.getElementType ());
1159
1156
}
1160
1157
1161
-
1162
1158
LLT llvm::getGCDType (LLT OrigTy, LLT TargetTy) {
1163
1159
const unsigned OrigSize = OrigTy.getSizeInBits ();
1164
1160
const unsigned TargetSize = TargetTy.getSizeInBits ();
0 commit comments