Skip to content

Commit fb22e22

Browse files
committed
Apply clang-format
1 parent e899c47 commit fb22e22

File tree

2 files changed

+40
-30
lines changed

2 files changed

+40
-30
lines changed

llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ struct ComplexDeinterleavingCompositeNode {
201201
}
202202
}
203203

204-
bool AreOperandsValid() {
205-
return OperandsValid;
206-
}
204+
bool AreOperandsValid() { return OperandsValid; }
207205
};
208206

209207
class ComplexDeinterleavingGraph {
@@ -918,11 +916,11 @@ ComplexDeinterleavingGraph::identifyNode(Value *R, Value *I, bool &FromCache) {
918916
return It->second;
919917
}
920918

921-
if(NodePtr CN = identifyPartialReduction(R, I))
919+
if (NodePtr CN = identifyPartialReduction(R, I))
922920
return CN;
923921

924922
bool IsReduction = RealPHI == R && (!ImagPHI || ImagPHI == I);
925-
if(!IsReduction && R->getType() != I->getType())
923+
if (!IsReduction && R->getType() != I->getType())
926924
return nullptr;
927925

928926
if (NodePtr CN = identifySplat(R, I))
@@ -1450,18 +1448,20 @@ bool ComplexDeinterleavingGraph::identifyNodes(Instruction *RootI) {
14501448
if (It != RootToNode.end()) {
14511449
auto RootNode = It->second;
14521450
assert(RootNode->Operation ==
1453-
ComplexDeinterleavingOperation::ReductionOperation || RootNode->Operation == ComplexDeinterleavingOperation::ReductionSingle);
1451+
ComplexDeinterleavingOperation::ReductionOperation ||
1452+
RootNode->Operation ==
1453+
ComplexDeinterleavingOperation::ReductionSingle);
14541454
// Find out which part, Real or Imag, comes later, and only if we come to
14551455
// the latest part, add it to OrderedRoots.
14561456
auto *R = cast<Instruction>(RootNode->Real);
14571457
auto *I = RootNode->Imag ? cast<Instruction>(RootNode->Imag) : nullptr;
14581458

14591459
Instruction *ReplacementAnchor;
1460-
if(I)
1460+
if (I)
14611461
ReplacementAnchor = R->comesBefore(I) ? I : R;
1462-
else
1462+
else
14631463
ReplacementAnchor = R;
1464-
1464+
14651465
if (ReplacementAnchor != RootI)
14661466
return false;
14671467
OrderedRoots.push_back(RootI);
@@ -1553,7 +1553,7 @@ void ComplexDeinterleavingGraph::identifyReductionNodes() {
15531553
for (size_t j = i + 1; j < OperationInstruction.size(); ++j) {
15541554
if (Processed[j])
15551555
continue;
1556-
1556+
15571557
auto *Imag = OperationInstruction[j];
15581558
if (Real->getType() != Imag->getType())
15591559
continue;
@@ -1588,18 +1588,20 @@ void ComplexDeinterleavingGraph::identifyReductionNodes() {
15881588

15891589
// We want to check that we have 2 operands, but the function attributes
15901590
// being counted as operands bloats this value.
1591-
if(Real->getNumOperands() < 2)
1591+
if (Real->getNumOperands() < 2)
15921592
continue;
15931593

15941594
RealPHI = ReductionInfo[Real].first;
15951595
ImagPHI = nullptr;
15961596
PHIsFound = false;
15971597
auto Node = identifyNode(Real->getOperand(0), Real->getOperand(1));
1598-
if(Node && PHIsFound) {
1599-
LLVM_DEBUG(dbgs() << "Identified single reduction starting from instruction: "
1600-
<< *Real << "/" << *ReductionInfo[Real].second << "\n");
1598+
if (Node && PHIsFound) {
1599+
LLVM_DEBUG(
1600+
dbgs() << "Identified single reduction starting from instruction: "
1601+
<< *Real << "/" << *ReductionInfo[Real].second << "\n");
16011602
Processed[i] = true;
1602-
auto RootNode = prepareCompositeNode(ComplexDeinterleavingOperation::ReductionSingle, Real, nullptr);
1603+
auto RootNode = prepareCompositeNode(
1604+
ComplexDeinterleavingOperation::ReductionSingle, Real, nullptr);
16031605
RootNode->addOperand(Node);
16041606
RootToNode[Real] = RootNode;
16051607
submitCompositeNode(RootNode);
@@ -2059,7 +2061,8 @@ Value *ComplexDeinterleavingGraph::replaceNode(IRBuilderBase &Builder,
20592061
return ReplacementNode;
20602062
}
20612063

2062-
void ComplexDeinterleavingGraph::processReductionSingle(Value *OperationReplacement, RawNodePtr Node) {
2064+
void ComplexDeinterleavingGraph::processReductionSingle(
2065+
Value *OperationReplacement, RawNodePtr Node) {
20632066
auto *Real = cast<Instruction>(Node->Real);
20642067
auto *OldPHI = ReductionInfo[Real].first;
20652068
auto *NewPHI = OldToNewPHI[OldPHI];
@@ -2071,21 +2074,21 @@ void ComplexDeinterleavingGraph::processReductionSingle(Value *OperationReplacem
20712074
IRBuilder<> Builder(Incoming->getTerminator());
20722075

20732076
Value *NewInit = nullptr;
2074-
if(auto *C = dyn_cast<Constant>(Init)) {
2075-
if(C->isZeroValue())
2077+
if (auto *C = dyn_cast<Constant>(Init)) {
2078+
if (C->isZeroValue())
20762079
NewInit = Constant::getNullValue(NewVTy);
20772080
}
20782081

20792082
if (!NewInit)
20802083
NewInit = Builder.CreateIntrinsic(Intrinsic::vector_interleave2, NewVTy,
2081-
{Init, Constant::getNullValue(VTy)});
2084+
{Init, Constant::getNullValue(VTy)});
20822085

20832086
NewPHI->addIncoming(NewInit, Incoming);
20842087
NewPHI->addIncoming(OperationReplacement, BackEdge);
20852088

20862089
auto *FinalReduction = ReductionInfo[Real].second;
20872090
Builder.SetInsertPoint(&*FinalReduction->getParent()->getFirstInsertionPt());
2088-
// TODO Ensure that the `AddReduce` here matches the original, found in `FinalReduction`
2091+
20892092
auto *AddReduce = Builder.CreateAddReduce(OperationReplacement);
20902093
FinalReduction->replaceAllUsesWith(AddReduce);
20912094
}
@@ -2151,7 +2154,8 @@ void ComplexDeinterleavingGraph::replaceNodes() {
21512154
ReductionInfo[RootImag].first->removeIncomingValue(BackEdge);
21522155
DeadInstrRoots.push_back(RootReal);
21532156
DeadInstrRoots.push_back(RootImag);
2154-
} else if(RootNode->Operation == ComplexDeinterleavingOperation::ReductionSingle) {
2157+
} else if (RootNode->Operation ==
2158+
ComplexDeinterleavingOperation::ReductionSingle) {
21552159
auto *RootInst = cast<Instruction>(RootNode->Real);
21562160
ReductionInfo[RootInst].first->removeIncomingValue(BackEdge);
21572161
DeadInstrRoots.push_back(ReductionInfo[RootInst].second);

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29230,7 +29230,10 @@ Value *AArch64TargetLowering::createComplexDeinterleavingIR(
2923029230

2923129231
if (TyWidth > 128) {
2923229232
int Stride = Ty->getElementCount().getKnownMinValue() / 2;
29233-
int AccStride = cast<VectorType>(Accumulator->getType())->getElementCount().getKnownMinValue() / 2;
29233+
int AccStride = cast<VectorType>(Accumulator->getType())
29234+
->getElementCount()
29235+
.getKnownMinValue() /
29236+
2;
2923429237
auto *HalfTy = VectorType::getHalfElementsVectorType(Ty);
2923529238
auto *LowerSplitA = B.CreateExtractVector(HalfTy, InputA, B.getInt64(0));
2923629239
auto *LowerSplitB = B.CreateExtractVector(HalfTy, InputB, B.getInt64(0));
@@ -29241,19 +29244,22 @@ Value *AArch64TargetLowering::createComplexDeinterleavingIR(
2924129244
Value *LowerSplitAcc = nullptr;
2924229245
Value *UpperSplitAcc = nullptr;
2924329246
Type *FullTy = Ty;
29244-
FullTy = Accumulator->getType();
29245-
auto *HalfAccTy = VectorType::getHalfElementsVectorType(cast<VectorType>(Accumulator->getType()));
29246-
LowerSplitAcc = B.CreateExtractVector(HalfAccTy, Accumulator, B.getInt64(0));
29247-
UpperSplitAcc =
29248-
B.CreateExtractVector(HalfAccTy, Accumulator, B.getInt64(AccStride));
29247+
FullTy = Accumulator->getType();
29248+
auto *HalfAccTy = VectorType::getHalfElementsVectorType(
29249+
cast<VectorType>(Accumulator->getType()));
29250+
LowerSplitAcc =
29251+
B.CreateExtractVector(HalfAccTy, Accumulator, B.getInt64(0));
29252+
UpperSplitAcc =
29253+
B.CreateExtractVector(HalfAccTy, Accumulator, B.getInt64(AccStride));
2924929254
auto *LowerSplitInt = createComplexDeinterleavingIR(
2925029255
B, OperationType, Rotation, LowerSplitA, LowerSplitB, LowerSplitAcc);
2925129256
auto *UpperSplitInt = createComplexDeinterleavingIR(
2925229257
B, OperationType, Rotation, UpperSplitA, UpperSplitB, UpperSplitAcc);
2925329258

29254-
auto *Result = B.CreateInsertVector(FullTy, PoisonValue::get(FullTy), LowerSplitInt,
29255-
B.getInt64(0));
29256-
return B.CreateInsertVector(FullTy, Result, UpperSplitInt, B.getInt64(AccStride));
29259+
auto *Result = B.CreateInsertVector(FullTy, PoisonValue::get(FullTy),
29260+
LowerSplitInt, B.getInt64(0));
29261+
return B.CreateInsertVector(FullTy, Result, UpperSplitInt,
29262+
B.getInt64(AccStride));
2925729263
}
2925829264

2925929265
if (OperationType == ComplexDeinterleavingOperation::CMulPartial) {

0 commit comments

Comments
 (0)