Skip to content

Commit b241068

Browse files
committed
Apply clang-format
1 parent 838dff4 commit b241068

File tree

2 files changed

+59
-55
lines changed

2 files changed

+59
-55
lines changed

llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -906,75 +906,73 @@ ComplexDeinterleavingGraph::NodePtr
906906
ComplexDeinterleavingGraph::identifyDotProduct(Value *V) {
907907
auto *Inst = cast<Instruction>(V);
908908

909-
if(!TL->isComplexDeinterleavingOperationSupported(ComplexDeinterleavingOperation::CDot, Inst->getType())) {
910-
LLVM_DEBUG(dbgs() << "Target doesn't support complex deinterleaving operation CDot with the type " << *Inst->getType() << "\n");
909+
if (!TL->isComplexDeinterleavingOperationSupported(
910+
ComplexDeinterleavingOperation::CDot, Inst->getType())) {
911+
LLVM_DEBUG(dbgs() << "Target doesn't support complex deinterleaving "
912+
"operation CDot with the type "
913+
<< *Inst->getType() << "\n");
911914
return nullptr;
912915
}
913916

914917
auto *RealUser = cast<Instruction>(*Inst->user_begin());
915918

916-
NodePtr CN = prepareCompositeNode(ComplexDeinterleavingOperation::CDot, Inst, nullptr);
919+
NodePtr CN =
920+
prepareCompositeNode(ComplexDeinterleavingOperation::CDot, Inst, nullptr);
917921

918922
NodePtr ANode;
919923

920-
const Intrinsic::ID PartialReduceInt = Intrinsic::experimental_vector_partial_reduce_add;
924+
const Intrinsic::ID PartialReduceInt =
925+
Intrinsic::experimental_vector_partial_reduce_add;
921926

922927
Value *AReal = nullptr;
923928
Value *AImag = nullptr;
924929
Value *BReal = nullptr;
925930
Value *BImag = nullptr;
926931
Value *Phi = nullptr;
927932

928-
auto UnwrapCast = [](Value *V) -> Value* {
929-
if(auto *CI = dyn_cast<CastInst>(V))
933+
auto UnwrapCast = [](Value *V) -> Value * {
934+
if (auto *CI = dyn_cast<CastInst>(V))
930935
return CI->getOperand(0);
931936
return V;
932937
};
933-
934-
auto PatternRot0 =
935-
m_Intrinsic<PartialReduceInt>(
936-
m_Intrinsic<PartialReduceInt>(
937-
m_Value(Phi),
938-
m_Mul(m_Value(BReal), m_Value(AReal))),
939-
m_Neg(m_Mul(m_Value(BImag), m_Value(AImag))));
940-
941-
auto PatternRot270 =
942-
m_Intrinsic<PartialReduceInt>(
943-
m_Intrinsic<PartialReduceInt>(
944-
m_Value(Phi),
945-
m_Neg(m_Mul(m_Value(BReal), m_Value(AImag)))),
946-
m_Mul(m_Value(BImag), m_Value(AReal)));
947-
948-
if(match(Inst, PatternRot0)) {
938+
939+
auto PatternRot0 = m_Intrinsic<PartialReduceInt>(
940+
m_Intrinsic<PartialReduceInt>(m_Value(Phi),
941+
m_Mul(m_Value(BReal), m_Value(AReal))),
942+
m_Neg(m_Mul(m_Value(BImag), m_Value(AImag))));
943+
944+
auto PatternRot270 = m_Intrinsic<PartialReduceInt>(
945+
m_Intrinsic<PartialReduceInt>(
946+
m_Value(Phi), m_Neg(m_Mul(m_Value(BReal), m_Value(AImag)))),
947+
m_Mul(m_Value(BImag), m_Value(AReal)));
948+
949+
if (match(Inst, PatternRot0)) {
949950
CN->Rotation = ComplexDeinterleavingRotation::Rotation_0;
950-
}else if(match(Inst, PatternRot270)) {
951+
} else if (match(Inst, PatternRot270)) {
951952
CN->Rotation = ComplexDeinterleavingRotation::Rotation_270;
952-
}else {
953+
} else {
953954
Value *A0, *A1;
954955
// The rotations 90 and 180 share the same operation pattern, so inspect the
955-
// order of the operands, identifying where the real and imaginary components
956-
// of A go, to discern between the aforementioned rotations.
957-
auto PatternRot90Rot180 =
958-
m_Intrinsic<PartialReduceInt>(
959-
m_Intrinsic<PartialReduceInt>(
960-
m_Value(Phi),
961-
m_Mul(m_Value(BReal), m_Value(A0))
962-
),
963-
m_Mul(m_Value(BImag), m_Value(A1)));
964-
965-
if(!match(Inst, PatternRot90Rot180))
956+
// order of the operands, identifying where the real and imaginary
957+
// components of A go, to discern between the aforementioned rotations.
958+
auto PatternRot90Rot180 = m_Intrinsic<PartialReduceInt>(
959+
m_Intrinsic<PartialReduceInt>(m_Value(Phi),
960+
m_Mul(m_Value(BReal), m_Value(A0))),
961+
m_Mul(m_Value(BImag), m_Value(A1)));
962+
963+
if (!match(Inst, PatternRot90Rot180))
966964
return nullptr;
967-
965+
968966
A0 = UnwrapCast(A0);
969967
A1 = UnwrapCast(A1);
970968

971969
// Test if A0 is real/A1 is imag
972970
ANode = identifyNode(A0, A1);
973-
if(!ANode) {
971+
if (!ANode) {
974972
// Test if A0 is imag/A1 is real
975973
ANode = identifyNode(A1, A0);
976974
// Unable to identify operand components, thus unable to identify rotation
977-
if(!ANode)
975+
if (!ANode)
978976
return nullptr;
979977
CN->Rotation = ComplexDeinterleavingRotation::Rotation_90;
980978
AReal = A1;
@@ -994,10 +992,14 @@ ComplexDeinterleavingGraph::identifyDotProduct(Value *V) {
994992
bool WasANodeFromCache = false;
995993
NodePtr Node = identifyNode(AReal, AImag, WasANodeFromCache);
996994

997-
// In the case that a node was identified to figure out the rotation, ensure that trying to
998-
// identify a node with AReal and AImag post-unwrap results in the same node
999-
if(Node && ANode && !WasANodeFromCache) {
1000-
LLVM_DEBUG(dbgs() << "Identified node is different from previously identified node. Unable to confidently generate a complex operation node\n");
995+
// In the case that a node was identified to figure out the rotation, ensure
996+
// that trying to identify a node with AReal and AImag post-unwrap results in
997+
// the same node
998+
if (Node && ANode && !WasANodeFromCache) {
999+
LLVM_DEBUG(
1000+
dbgs()
1001+
<< "Identified node is different from previously identified node. "
1002+
"Unable to confidently generate a complex operation node\n");
10011003
return nullptr;
10021004
}
10031005

@@ -1014,18 +1016,19 @@ ComplexDeinterleavingGraph::identifyPartialReduction(Value *R, Value *I) {
10141016
return nullptr;
10151017

10161018
VectorType *RealTy = dyn_cast<VectorType>(R->getType());
1017-
if(!RealTy)
1019+
if (!RealTy)
10181020
return nullptr;
10191021
VectorType *ImagTy = dyn_cast<VectorType>(I->getType());
1020-
if(!ImagTy)
1022+
if (!ImagTy)
10211023
return nullptr;
10221024

1023-
if(RealTy->isScalableTy() != ImagTy->isScalableTy())
1025+
if (RealTy->isScalableTy() != ImagTy->isScalableTy())
10241026
return nullptr;
1025-
if(RealTy->getElementType() != ImagTy->getElementType())
1027+
if (RealTy->getElementType() != ImagTy->getElementType())
10261028
return nullptr;
10271029

1028-
// `I` is known to only have one user, so iterate over the Phi (R) users to find the common user between R and I
1030+
// `I` is known to only have one user, so iterate over the Phi (R) users to
1031+
// find the common user between R and I
10291032
auto *CommonUser = *I->user_begin();
10301033
bool CommonUserFound = false;
10311034
for (auto *User : R->users()) {
@@ -1039,10 +1042,11 @@ ComplexDeinterleavingGraph::identifyPartialReduction(Value *R, Value *I) {
10391042
return nullptr;
10401043

10411044
auto *IInst = dyn_cast<IntrinsicInst>(CommonUser);
1042-
if (!IInst || IInst->getIntrinsicID() != Intrinsic::experimental_vector_partial_reduce_add)
1045+
if (!IInst || IInst->getIntrinsicID() !=
1046+
Intrinsic::experimental_vector_partial_reduce_add)
10431047
return nullptr;
10441048

1045-
if(NodePtr CN = identifyDotProduct(IInst))
1049+
if (NodePtr CN = identifyDotProduct(IInst))
10461050
return CN;
10471051

10481052
return nullptr;
@@ -1063,7 +1067,7 @@ ComplexDeinterleavingGraph::identifyNode(Value *R, Value *I, bool &FromCache) {
10631067
return It->second;
10641068
}
10651069

1066-
if(NodePtr CN = identifyPartialReduction(R, I))
1070+
if (NodePtr CN = identifyPartialReduction(R, I))
10671071
return CN;
10681072

10691073
bool IsReduction = RealPHI == R && (!ImagPHI || ImagPHI == I);
@@ -2138,8 +2142,7 @@ Value *ComplexDeinterleavingGraph::replaceNode(IRBuilderBase &Builder,
21382142
assert(!Input1 || (Input0->getType() == Input1->getType() &&
21392143
"Node inputs need to be of the same type"));
21402144
ReplacementNode = TL->createComplexDeinterleavingIR(
2141-
Builder, Node->Operation, Node->Rotation, Input0, Input1,
2142-
Accumulator);
2145+
Builder, Node->Operation, Node->Rotation, Input0, Input1, Accumulator);
21432146
break;
21442147
}
21452148
case ComplexDeinterleavingOperation::CAdd:

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29317,10 +29317,11 @@ Value *AArch64TargetLowering::createComplexDeinterleavingIR(
2931729317
return B.CreateIntrinsic(IntId, Ty, {InputA, InputB});
2931829318
}
2931929319

29320-
if (OperationType == ComplexDeinterleavingOperation::CDot && IsInt && IsScalable) {
29320+
if (OperationType == ComplexDeinterleavingOperation::CDot && IsInt &&
29321+
IsScalable) {
2932129322
return B.CreateIntrinsic(
29322-
Intrinsic::aarch64_sve_cdot, Accumulator->getType(),
29323-
{Accumulator, InputA, InputB, B.getInt32((int)Rotation * 90)});
29323+
Intrinsic::aarch64_sve_cdot, Accumulator->getType(),
29324+
{Accumulator, InputA, InputB, B.getInt32((int)Rotation * 90)});
2932429325
}
2932529326

2932629327
return nullptr;

0 commit comments

Comments
 (0)