Skip to content

Commit 775dea6

Browse files
fixup! clang-format
1 parent 238666d commit 775dea6

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ void llvm::getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU) {
10721072

10731073
LLT llvm::getLCMType(LLT OrigTy, LLT TargetTy) {
10741074
if (OrigTy.getSizeInBits() == TargetTy.getSizeInBits())
1075-
return OrigTy;
1075+
return OrigTy;
10761076

10771077
if (OrigTy.isVector() && TargetTy.isVector()) {
10781078
LLT OrigElt = OrigTy.getElementType();
@@ -1090,57 +1090,54 @@ LLT llvm::getLCMType(LLT OrigTy, LLT TargetTy) {
10901090
"getLCMType not implemented between fixed and scalable vectors.");
10911091

10921092
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());
10961095
// Prefer the original element type.
10971096
ElementCount Mul = OrigTy.getElementCount().multiplyCoefficientBy(
10981097
TargetTy.getElementCount().getKnownMinValue());
10991098
return LLT::vector(Mul.divideCoefficientBy(GCDMinElts),
11001099
OrigTy.getElementType());
11011100
}
11021101
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());
11061105
return LLT::vector(
11071106
ElementCount::get(LCM / OrigElt.getSizeInBits(), OrigTy.isScalable()),
11081107
OrigElt);
11091108
}
11101109

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);
11441141
}
11451142

11461143
LLT llvm::getCoverTy(LLT OrigTy, LLT TargetTy) {
@@ -1158,7 +1155,6 @@ LLT llvm::getCoverTy(LLT OrigTy, LLT TargetTy) {
11581155
OrigTy.getElementType());
11591156
}
11601157

1161-
11621158
LLT llvm::getGCDType(LLT OrigTy, LLT TargetTy) {
11631159
const unsigned OrigSize = OrigTy.getSizeInBits();
11641160
const unsigned TargetSize = TargetTy.getSizeInBits();

0 commit comments

Comments
 (0)