Skip to content

Commit 1ab52f2

Browse files
committed
XXX: Manual unittest
1 parent 7a307f3 commit 1ab52f2

File tree

5 files changed

+41
-39
lines changed

5 files changed

+41
-39
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -493,26 +493,26 @@ class VPBlockBase {
493493
const VPRegionBlock *getParent() const { return Parent; }
494494

495495
/// \return A pointer to the plan containing the current block.
496-
VPlan *getPlan();
496+
LLVM_FUNC_ABI VPlan *getPlan();
497497
const VPlan *getPlan() const;
498498

499499
/// Sets the pointer of the plan containing the block. The block must be the
500500
/// entry block into the VPlan.
501-
void setPlan(VPlan *ParentPlan);
501+
LLVM_FUNC_ABI void setPlan(VPlan *ParentPlan);
502502

503503
void setParent(VPRegionBlock *P) { Parent = P; }
504504

505505
/// \return the VPBasicBlock that is the entry of this VPBlockBase,
506506
/// recursively, if the latter is a VPRegionBlock. Otherwise, if this
507507
/// VPBlockBase is a VPBasicBlock, it is returned.
508508
const VPBasicBlock *getEntryBasicBlock() const;
509-
VPBasicBlock *getEntryBasicBlock();
509+
LLVM_FUNC_ABI VPBasicBlock *getEntryBasicBlock();
510510

511511
/// \return the VPBasicBlock that is the exiting this VPBlockBase,
512512
/// recursively, if the latter is a VPRegionBlock. Otherwise, if this
513513
/// VPBlockBase is a VPBasicBlock, it is returned.
514514
const VPBasicBlock *getExitingBasicBlock() const;
515-
VPBasicBlock *getExitingBasicBlock();
515+
LLVM_FUNC_ABI VPBasicBlock *getExitingBasicBlock();
516516

517517
const VPBlocksTy &getSuccessors() const { return Successors; }
518518
VPBlocksTy &getSuccessors() { return Successors; }
@@ -735,7 +735,7 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
735735

736736
/// Insert an unlinked recipe into a basic block immediately before
737737
/// the specified recipe.
738-
void insertBefore(VPRecipeBase *InsertPos);
738+
LLVM_FUNC_ABI void insertBefore(VPRecipeBase *InsertPos);
739739
/// Insert an unlinked recipe into \p BB immediately before the insertion
740740
/// point \p IP;
741741
void insertBefore(VPBasicBlock &BB, iplist<VPRecipeBase>::iterator IP);
@@ -746,12 +746,12 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
746746

747747
/// Unlink this recipe from its current VPBasicBlock and insert it into
748748
/// the VPBasicBlock that MovePos lives in, right after MovePos.
749-
void moveAfter(VPRecipeBase *MovePos);
749+
LLVM_FUNC_ABI void moveAfter(VPRecipeBase *MovePos);
750750

751751
/// Unlink this recipe and insert into BB before I.
752752
///
753753
/// \pre I is a valid iterator into BB.
754-
void moveBefore(VPBasicBlock &BB, iplist<VPRecipeBase>::iterator I);
754+
LLVM_FUNC_ABI void moveBefore(VPBasicBlock &BB, iplist<VPRecipeBase>::iterator I);
755755

756756
/// This method unlinks 'this' from the containing basic block, but does not
757757
/// delete it.
@@ -760,7 +760,7 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
760760
/// This method unlinks 'this' from the containing basic block and deletes it.
761761
///
762762
/// \returns an iterator pointing to the element after the erased one
763-
iplist<VPRecipeBase>::iterator eraseFromParent();
763+
LLVM_FUNC_ABI iplist<VPRecipeBase>::iterator eraseFromParent();
764764

765765
/// Returns the underlying instruction, if the recipe is a VPValue or nullptr
766766
/// otherwise.
@@ -782,18 +782,18 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
782782
}
783783

784784
/// Returns true if the recipe may have side-effects.
785-
bool mayHaveSideEffects() const;
785+
LLVM_FUNC_ABI bool mayHaveSideEffects() const;
786786

787787
/// Returns true for PHI-like recipes.
788788
bool isPhi() const {
789789
return getVPDefID() >= VPFirstPHISC && getVPDefID() <= VPLastPHISC;
790790
}
791791

792792
/// Returns true if the recipe may read from memory.
793-
bool mayReadFromMemory() const;
793+
LLVM_FUNC_ABI bool mayReadFromMemory() const;
794794

795795
/// Returns true if the recipe may write to memory.
796-
bool mayWriteToMemory() const;
796+
LLVM_FUNC_ABI bool mayWriteToMemory() const;
797797

798798
/// Returns true if the recipe may read from or write to memory.
799799
bool mayReadOrWriteMemory() const {
@@ -856,7 +856,7 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
856856
char AllowContract : 1;
857857
char ApproxFunc : 1;
858858

859-
FastMathFlagsTy(const FastMathFlags &FMF);
859+
LLVM_FUNC_ABI FastMathFlagsTy(const FastMathFlags &FMF);
860860
};
861861

862862
OperationType OpType;
@@ -1015,7 +1015,7 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
10151015
/// While as any Recipe it may generate a sequence of IR instructions when
10161016
/// executed, these instructions would always form a single-def expression as
10171017
/// the VPInstruction is also a single def-use vertex.
1018-
class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
1018+
class LLVM_CLASS_ABI VPInstruction : public VPRecipeWithIRFlags, public VPValue {
10191019
friend class VPlanSlp;
10201020

10211021
public:
@@ -1151,7 +1151,7 @@ class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
11511151
/// VPWidenRecipe is a recipe for producing a copy of vector type its
11521152
/// ingredient. This recipe covers most of the traditional vectorization cases
11531153
/// where each ingredient transforms into a vectorized version of itself.
1154-
class VPWidenRecipe : public VPRecipeWithIRFlags, public VPValue {
1154+
class LLVM_CLASS_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPValue {
11551155
unsigned Opcode;
11561156

11571157
public:
@@ -1213,7 +1213,7 @@ class VPWidenCastRecipe : public VPRecipeBase, public VPValue {
12131213
};
12141214

12151215
/// A recipe for widening Call instructions.
1216-
class VPWidenCallRecipe : public VPRecipeBase, public VPValue {
1216+
class LLVM_CLASS_ABI VPWidenCallRecipe : public VPRecipeBase, public VPValue {
12171217
/// ID of the vector intrinsic to call when widening the call. If set the
12181218
/// Intrinsic::not_intrinsic, a library call will be used instead.
12191219
Intrinsic::ID VectorIntrinsicID;
@@ -1246,7 +1246,7 @@ class VPWidenCallRecipe : public VPRecipeBase, public VPValue {
12461246
};
12471247

12481248
/// A recipe for widening select instructions.
1249-
struct VPWidenSelectRecipe : public VPRecipeBase, public VPValue {
1249+
struct LLVM_CLASS_ABI VPWidenSelectRecipe : public VPRecipeBase, public VPValue {
12501250
template <typename IterT>
12511251
VPWidenSelectRecipe(SelectInst &I, iterator_range<IterT> Operands)
12521252
: VPRecipeBase(VPDef::VPWidenSelectSC, Operands, I.getDebugLoc()),
@@ -1275,7 +1275,7 @@ struct VPWidenSelectRecipe : public VPRecipeBase, public VPValue {
12751275
};
12761276

12771277
/// A recipe for handling GEP instructions.
1278-
class VPWidenGEPRecipe : public VPRecipeWithIRFlags, public VPValue {
1278+
class LLVM_CLASS_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags, public VPValue {
12791279
bool isPointerLoopInvariant() const {
12801280
return getOperand(0)->isDefinedOutsideVectorRegions();
12811281
}
@@ -1618,7 +1618,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe {
16181618

16191619
/// A recipe for vectorizing a phi-node as a sequence of mask-based select
16201620
/// instructions.
1621-
class VPBlendRecipe : public VPRecipeBase, public VPValue {
1621+
class LLVM_CLASS_ABI VPBlendRecipe : public VPRecipeBase, public VPValue {
16221622
public:
16231623
/// The blend operation is a User of the incoming values and of their
16241624
/// respective masks, ordered [I0, M0, I1, M1, ...]. Note that a single value
@@ -1668,7 +1668,7 @@ class VPBlendRecipe : public VPRecipeBase, public VPValue {
16681668
/// or stores into one wide load/store and shuffles. The first operand of a
16691669
/// VPInterleave recipe is the address, followed by the stored values, followed
16701670
/// by an optional mask.
1671-
class VPInterleaveRecipe : public VPRecipeBase {
1671+
class LLVM_CLASS_ABI VPInterleaveRecipe : public VPRecipeBase {
16721672
const InterleaveGroup<Instruction> *IG;
16731673

16741674
/// Indicates if the interleave group is in a conditional block and requires a
@@ -1752,7 +1752,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
17521752
/// A recipe to represent inloop reduction operations, performing a reduction on
17531753
/// a vector operand into a scalar value, and adding the result to a chain.
17541754
/// The Operands are {ChainOp, VecOp, [Condition]}.
1755-
class VPReductionRecipe : public VPRecipeBase, public VPValue {
1755+
class LLVM_CLASS_ABI VPReductionRecipe : public VPRecipeBase, public VPValue {
17561756
/// The recurrence decriptor for the reduction in question.
17571757
const RecurrenceDescriptor &RdxDesc;
17581758

@@ -1792,7 +1792,7 @@ class VPReductionRecipe : public VPRecipeBase, public VPValue {
17921792
/// copies of the original scalar type, one per lane, instead of producing a
17931793
/// single copy of widened type for all lanes. If the instruction is known to be
17941794
/// uniform only one copy, per lane zero, will be generated.
1795-
class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPValue {
1795+
class LLVM_CLASS_ABI VPReplicateRecipe : public VPRecipeWithIRFlags, public VPValue {
17961796
/// Indicator if only a single replica per lane is needed.
17971797
bool IsUniform;
17981798

@@ -1855,7 +1855,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPValue {
18551855
};
18561856

18571857
/// A recipe for generating conditional branches on the bits of a mask.
1858-
class VPBranchOnMaskRecipe : public VPRecipeBase {
1858+
class LLVM_CLASS_ABI VPBranchOnMaskRecipe : public VPRecipeBase {
18591859
public:
18601860
VPBranchOnMaskRecipe(VPValue *BlockInMask)
18611861
: VPRecipeBase(VPDef::VPBranchOnMaskSC, {}) {
@@ -1902,7 +1902,7 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
19021902
/// order to merge values that are set under such a branch and feed their uses.
19031903
/// The phi nodes can be scalar or vector depending on the users of the value.
19041904
/// This recipe works in concert with VPBranchOnMaskRecipe.
1905-
class VPPredInstPHIRecipe : public VPRecipeBase, public VPValue {
1905+
class LLVM_CLASS_ABI VPPredInstPHIRecipe : public VPRecipeBase, public VPValue {
19061906
public:
19071907
/// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
19081908
/// nodes after merging back from a Branch-on-Mask.
@@ -1935,7 +1935,7 @@ class VPPredInstPHIRecipe : public VPRecipeBase, public VPValue {
19351935
/// - For store: Address, stored value, optional mask
19361936
/// TODO: We currently execute only per-part unless a specific instance is
19371937
/// provided.
1938-
class VPWidenMemoryInstructionRecipe : public VPRecipeBase {
1938+
class LLVM_CLASS_ABI VPWidenMemoryInstructionRecipe : public VPRecipeBase {
19391939
Instruction &Ingredient;
19401940

19411941
// Whether the loaded-from / stored-to addresses are consecutive.
@@ -2057,7 +2057,7 @@ class VPExpandSCEVRecipe : public VPRecipeBase, public VPValue {
20572057
/// start value (either 0 or the resume value when vectorizing the epilogue
20582058
/// loop). VPWidenCanonicalIVRecipe represents the vector version of the
20592059
/// canonical induction variable.
2060-
class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
2060+
class LLVM_CLASS_ABI VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
20612061
public:
20622062
VPCanonicalIVPHIRecipe(VPValue *StartV, DebugLoc DL)
20632063
: VPHeaderPHIRecipe(VPDef::VPCanonicalIVPHISC, nullptr, StartV, DL) {}
@@ -2206,7 +2206,7 @@ class VPDerivedIVRecipe : public VPRecipeBase, public VPValue {
22062206

22072207
/// A recipe for handling phi nodes of integer and floating-point inductions,
22082208
/// producing their scalar values.
2209-
class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, public VPValue {
2209+
class LLVM_CLASS_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, public VPValue {
22102210
Instruction::BinaryOps InductionOpcode;
22112211

22122212
public:
@@ -2250,7 +2250,7 @@ class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, public VPValue {
22502250
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
22512251
/// holds a sequence of zero or more VPRecipe's each representing a sequence of
22522252
/// output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
2253-
class VPBasicBlock : public VPBlockBase {
2253+
class LLVM_CLASS_ABI VPBasicBlock : public VPBlockBase {
22542254
public:
22552255
using RecipeListTy = iplist<VPRecipeBase>;
22562256

@@ -2374,7 +2374,7 @@ class VPBasicBlock : public VPBlockBase {
23742374
/// this replication indicator helps to keep a single model for multiple
23752375
/// candidate VF's. The actual replication takes place only once the desired VF
23762376
/// and UF have been determined.
2377-
class VPRegionBlock : public VPBlockBase {
2377+
class LLVM_CLASS_ABI VPRegionBlock : public VPBlockBase {
23782378
/// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
23792379
VPBlockBase *Entry;
23802380

@@ -2548,11 +2548,11 @@ class VPlan {
25482548
"preheader must be disconnected");
25492549
}
25502550

2551-
~VPlan();
2551+
LLVM_FUNC_ABI ~VPlan();
25522552

25532553
/// Create an initial VPlan with preheader and entry blocks. Creates a
25542554
/// VPExpandSCEVRecipe for \p TripCount and uses it as plan's trip count.
2555-
static VPlanPtr createInitialVPlan(const SCEV *TripCount,
2555+
LLVM_FUNC_ABI static VPlanPtr createInitialVPlan(const SCEV *TripCount,
25562556
ScalarEvolution &PSE);
25572557

25582558
/// Prepare the plan for execution, setting up the required live-in values.
@@ -2889,7 +2889,7 @@ class VPInterleavedAccessInfo {
28892889
InterleavedAccessInfo &IAI);
28902890

28912891
public:
2892-
VPInterleavedAccessInfo(VPlan &Plan, InterleavedAccessInfo &IAI);
2892+
LLVM_FUNC_ABI VPInterleavedAccessInfo(VPlan &Plan, InterleavedAccessInfo &IAI);
28932893

28942894
~VPInterleavedAccessInfo() {
28952895
SmallPtrSet<InterleaveGroup<VPInstruction> *, 4> DelSet;
@@ -2995,7 +2995,7 @@ class VPlanSlp {
29952995

29962996
/// Tries to build an SLP tree rooted at \p Operands and returns a
29972997
/// VPInstruction combining \p Operands, if they can be combined.
2998-
VPInstruction *buildGraph(ArrayRef<VPValue *> Operands);
2998+
LLVM_FUNC_ABI VPInstruction *buildGraph(ArrayRef<VPValue *> Operands);
29992999

30003000
/// Return the width of the widest combined bundle in bits.
30013001
unsigned getWidestBundleBits() const { return WidestBundleBits; }

llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class VPlanHCFGBuilder {
6565
: TheLoop(Lp), LI(LI), Plan(P) {}
6666

6767
/// Build H-CFG for TheLoop and update Plan accordingly.
68-
void buildHierarchicalCFG();
68+
LLVM_FUNC_ABI void buildHierarchicalCFG();
6969
};
7070
} // namespace llvm
7171

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class VPRecipeBuilder;
3131
struct VPlanTransforms {
3232
/// Replaces the VPInstructions in \p Plan with corresponding
3333
/// widen recipes.
34-
static void
34+
LLVM_FUNC_ABI static void
3535
VPInstructionsToVPRecipes(VPlanPtr &Plan,
3636
function_ref<const InductionDescriptor *(PHINode *)>
3737
GetIntOrFpInductionDescriptor,

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class VPValue {
6464
/// VPValue is not defined by any recipe modeled in VPlan.
6565
VPDef *Def;
6666

67-
VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
67+
LLVM_FUNC_ABI VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
6868

6969
// DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
7070
// the front-end and back-end of VPlan so that the middle-end is as
@@ -101,7 +101,7 @@ class VPValue {
101101
VPValue(const VPValue &) = delete;
102102
VPValue &operator=(const VPValue &) = delete;
103103

104-
virtual ~VPValue();
104+
LLVM_FUNC_ABI virtual ~VPValue();
105105

106106
/// \return an ID for the concrete type of this object.
107107
/// This is used to implement the classof checks. This should not be used
@@ -161,11 +161,11 @@ class VPValue {
161161
return Current != user_end();
162162
}
163163

164-
void replaceAllUsesWith(VPValue *New);
164+
LLVM_FUNC_ABI void replaceAllUsesWith(VPValue *New);
165165

166166
/// Returns the recipe defining this VPValue or nullptr if it is not defined
167167
/// by a recipe, i.e. is a live-in.
168-
VPRecipeBase *getDefiningRecipe();
168+
LLVM_FUNC_ABI VPRecipeBase *getDefiningRecipe();
169169
const VPRecipeBase *getDefiningRecipe() const;
170170

171171
/// Returns true if this VPValue is defined by a recipe.

llvm/lib/Transforms/Vectorize/VPlanVerifier.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
2525
#define LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
2626

27+
#include "llvm/Support/Compiler.h"
28+
2729
namespace llvm {
2830
class VPRegionBlock;
2931
class VPlan;
@@ -41,7 +43,7 @@ struct VPlanVerifier {
4143
/// 1. all phi-like recipes must be at the beginning of a block, with no other
4244
/// recipes in between. Note that currently there is still an exception for
4345
/// VPBlendRecipes.
44-
static bool verifyPlanIsValid(const VPlan &Plan);
46+
LLVM_FUNC_ABI static bool verifyPlanIsValid(const VPlan &Plan);
4547
};
4648
} // namespace llvm
4749

0 commit comments

Comments
 (0)