Skip to content

Commit 6b9cfdd

Browse files
committed
Merge branch 'pr-94268' into kernel-info-pgo
2 parents 2438390 + 517c018 commit 6b9cfdd

File tree

16 files changed

+376
-338
lines changed

16 files changed

+376
-338
lines changed

compiler-rt/lib/profile/InstrProfiling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void __llvm_profile_set_dumped(void);
306306

307307
/*!
308308
* \brief Write custom target-specific profiling data to a seperate file.
309-
* Used by libomptarget for GPU PGO.
309+
* Used by offload PGO.
310310
*/
311311
int __llvm_write_custom_profile(const char *Target,
312312
const __llvm_profile_data *DataBegin,

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3311,7 +3311,7 @@ class BoUpSLP {
33113311

33123312
/// For gather/buildvector/alt opcode (TODO) nodes, which are combined from
33133313
/// other nodes as a series of insertvector instructions.
3314-
SmallVector<std::pair<unsigned, unsigned>, 0> CombinedEntriesWithIndices;
3314+
SmallVector<std::pair<unsigned, unsigned>, 2> CombinedEntriesWithIndices;
33153315

33163316
private:
33173317
/// The operands of each instruction in each lane Operands[op_index][lane].
@@ -3545,6 +3545,13 @@ class BoUpSLP {
35453545
for (const auto &EInfo : UserTreeIndices)
35463546
dbgs() << EInfo << ", ";
35473547
dbgs() << "\n";
3548+
if (!CombinedEntriesWithIndices.empty()) {
3549+
dbgs() << "Combined entries: ";
3550+
interleaveComma(CombinedEntriesWithIndices, dbgs(), [&](const auto &P) {
3551+
dbgs() << "Entry index " << P.first << " with offset " << P.second;
3552+
});
3553+
dbgs() << "\n";
3554+
}
35483555
}
35493556
#endif
35503557
};

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,6 @@ class VPlan {
38633863
/// been modeled in VPlan directly.
38643864
DenseMap<const SCEV *, VPValue *> SCEVToExpansion;
38653865

3866-
public:
38673866
/// Construct a VPlan with \p Entry to the plan and with \p ScalarHeader
38683867
/// wrapping the original header of the scalar loop.
38693868
VPlan(VPBasicBlock *Entry, VPIRBasicBlock *ScalarHeader)
@@ -3873,18 +3872,20 @@ class VPlan {
38733872
"scalar header must be a leaf node");
38743873
}
38753874

3876-
/// Construct a VPlan with \p Entry entering the plan, trip count \p TC and
3877-
/// with \p ScalarHeader wrapping the original header of the scalar loop.
3878-
VPlan(VPBasicBlock *Entry, VPValue *TC, VPIRBasicBlock *ScalarHeader)
3879-
: VPlan(Entry, ScalarHeader) {
3880-
TripCount = TC;
3881-
}
3882-
3875+
public:
38833876
/// Construct a VPlan for \p L. This will create VPIRBasicBlocks wrapping the
38843877
/// original preheader and scalar header of \p L, to be used as entry and
38853878
/// scalar header blocks of the new VPlan.
38863879
VPlan(Loop *L);
38873880

3881+
/// Construct a VPlan with a new VPBasicBlock as entry, a VPIRBasicBlock
3882+
/// wrapping \p ScalarHeaderBB and a trip count of \p TC.
3883+
VPlan(BasicBlock *ScalarHeaderBB, VPValue *TC) {
3884+
setEntry(new VPBasicBlock("preheader"));
3885+
ScalarHeader = VPIRBasicBlock::fromBasicBlock(ScalarHeaderBB);
3886+
TripCount = TC;
3887+
}
3888+
38883889
~VPlan();
38893890

38903891
void setEntry(VPBasicBlock *VPBB) {

llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class Loop;
3232
class LoopInfo;
3333
class VPRegionBlock;
3434
class VPlan;
35-
class VPlanTestBase;
35+
class VPlanTestIRBase;
3636

3737
/// Main class to build the VPlan H-CFG for an incoming IR.
3838
class VPlanHCFGBuilder {
39-
friend VPlanTestBase;
39+
friend VPlanTestIRBase;
4040

4141
private:
4242
// The outermost loop of the input loop nest considered for vectorization.

llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
#include "../lib/Transforms/Vectorize/VPlan.h"
1111
#include "../lib/Transforms/Vectorize/VPlanDominatorTree.h"
12+
#include "VPlanTestBase.h"
1213
#include "gtest/gtest.h"
1314

1415
namespace llvm {
1516
namespace {
1617

17-
TEST(VPDominatorTreeTest, DominanceNoRegionsTest) {
18+
using VPDominatorTreeTest = VPlanTestBase;
19+
20+
TEST_F(VPDominatorTreeTest, DominanceNoRegionsTest) {
1821
// VPBB0
1922
// |
2023
// R1 {
@@ -24,8 +27,8 @@ TEST(VPDominatorTreeTest, DominanceNoRegionsTest) {
2427
// \ /
2528
// VPBB4
2629
// }
27-
VPBasicBlock *VPPH = new VPBasicBlock("ph");
28-
VPBasicBlock *VPBB0 = new VPBasicBlock("VPBB0");
30+
VPlan &Plan = getPlan();
31+
VPBasicBlock *VPBB0 = Plan.getEntry();
2932
VPBasicBlock *VPBB1 = new VPBasicBlock("VPBB1");
3033
VPBasicBlock *VPBB2 = new VPBasicBlock("VPBB2");
3134
VPBasicBlock *VPBB3 = new VPBasicBlock("VPBB3");
@@ -40,12 +43,7 @@ TEST(VPDominatorTreeTest, DominanceNoRegionsTest) {
4043
VPBlockUtils::connectBlocks(VPBB2, VPBB4);
4144
VPBlockUtils::connectBlocks(VPBB3, VPBB4);
4245

43-
LLVMContext C;
44-
auto *ScalarHeader = BasicBlock::Create(C, "");
45-
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
46-
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
47-
VPBlockUtils::connectBlocks(VPPH, VPBB0);
48-
VPlan Plan(VPPH, ScalarHeaderVPBB);
46+
VPBlockUtils::connectBlocks(R1, Plan.getScalarHeader());
4947

5048
VPDominatorTree VPDT;
5149
VPDT.recalculate(Plan);
@@ -62,7 +60,6 @@ TEST(VPDominatorTreeTest, DominanceNoRegionsTest) {
6260
EXPECT_EQ(VPDT.findNearestCommonDominator(VPBB2, VPBB3), VPBB1);
6361
EXPECT_EQ(VPDT.findNearestCommonDominator(VPBB2, VPBB4), VPBB1);
6462
EXPECT_EQ(VPDT.findNearestCommonDominator(VPBB4, VPBB4), VPBB4);
65-
delete ScalarHeader;
6663
}
6764

6865
static void
@@ -76,9 +73,7 @@ checkDomChildren(VPDominatorTree &VPDT, VPBlockBase *Src,
7673
EXPECT_EQ(Children, ExpectedNodes);
7774
}
7875

79-
TEST(VPDominatorTreeTest, DominanceRegionsTest) {
80-
LLVMContext C;
81-
auto *ScalarHeader = BasicBlock::Create(C, "");
76+
TEST_F(VPDominatorTreeTest, DominanceRegionsTest) {
8277
{
8378
// 2 consecutive regions.
8479
// VPBB0
@@ -99,8 +94,8 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
9994
// R2BB2
10095
// }
10196
//
102-
VPBasicBlock *VPPH = new VPBasicBlock("ph");
103-
VPBasicBlock *VPBB0 = new VPBasicBlock("VPBB0");
97+
VPlan &Plan = getPlan();
98+
VPBasicBlock *VPBB0 = Plan.getEntry();
10499
VPBasicBlock *R1BB1 = new VPBasicBlock();
105100
VPBasicBlock *R1BB2 = new VPBasicBlock();
106101
VPBasicBlock *R1BB3 = new VPBasicBlock();
@@ -122,10 +117,7 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
122117
VPBlockUtils::connectBlocks(R2BB1, R2BB2);
123118
VPBlockUtils::connectBlocks(R1, R2);
124119

125-
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
126-
VPBlockUtils::connectBlocks(R2, ScalarHeaderVPBB);
127-
VPBlockUtils::connectBlocks(VPPH, VPBB0);
128-
VPlan Plan(VPPH, ScalarHeaderVPBB);
120+
VPBlockUtils::connectBlocks(R2, Plan.getScalarHeader());
129121
VPDominatorTree VPDT;
130122
VPDT.recalculate(Plan);
131123

@@ -177,7 +169,7 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
177169
// |
178170
// VPBB2
179171
//
180-
VPBasicBlock *VPPH = new VPBasicBlock("ph");
172+
VPlan &Plan = getPlan();
181173
VPBasicBlock *R1BB1 = new VPBasicBlock("R1BB1");
182174
VPBasicBlock *R1BB2 = new VPBasicBlock("R1BB2");
183175
VPBasicBlock *R1BB3 = new VPBasicBlock("R1BB3");
@@ -199,15 +191,12 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
199191
VPBlockUtils::connectBlocks(R1BB2, R1BB3);
200192
VPBlockUtils::connectBlocks(R2, R1BB3);
201193

202-
VPBasicBlock *VPBB1 = new VPBasicBlock("VPBB1");
194+
VPBasicBlock *VPBB1 = Plan.getEntry();
203195
VPBlockUtils::connectBlocks(VPBB1, R1);
204196
VPBasicBlock *VPBB2 = new VPBasicBlock("VPBB2");
205197
VPBlockUtils::connectBlocks(R1, VPBB2);
206198

207-
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
208-
VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
209-
VPBlockUtils::connectBlocks(VPPH, VPBB1);
210-
VPlan Plan(VPPH, ScalarHeaderVPBB);
199+
VPBlockUtils::connectBlocks(VPBB2, Plan.getScalarHeader());
211200
VPDominatorTree VPDT;
212201
VPDT.recalculate(Plan);
213202

@@ -220,9 +209,8 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
220209
checkDomChildren(VPDT, R2BB2, {R2BB3});
221210
checkDomChildren(VPDT, R2BB3, {});
222211
checkDomChildren(VPDT, R1BB3, {VPBB2});
223-
checkDomChildren(VPDT, VPBB2, {ScalarHeaderVPBB});
212+
checkDomChildren(VPDT, VPBB2, {Plan.getScalarHeader()});
224213
}
225-
delete ScalarHeader;
226214
}
227215

228216
} // namespace

llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace llvm {
1818
namespace {
1919

20-
class VPlanHCFGTest : public VPlanTestBase {};
20+
class VPlanHCFGTest : public VPlanTestIRBase {};
2121

2222
TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
2323
const char *ModuleString =

llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace llvm {
1717
namespace {
1818

19-
class VPlanSlpTest : public VPlanTestBase {
19+
class VPlanSlpTest : public VPlanTestIRBase {
2020
protected:
2121
TargetLibraryInfoImpl TLII;
2222
TargetLibraryInfo TLI;

0 commit comments

Comments
 (0)