summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2013-11-19 00:57:56 +0000
committerJuergen Ributzka <juergen@apple.com>2013-11-19 00:57:56 +0000
commit354362524a72b3fa43a6c09380b7ae3b2380cbba (patch)
treedb9821d531f3ec0554d83400221f54e4e322877b /tools
parent26efdc5621043d28dc0c78addc7b7a75d1591a10 (diff)
downloadexternal_llvm-354362524a72b3fa43a6c09380b7ae3b2380cbba.zip
external_llvm-354362524a72b3fa43a6c09380b7ae3b2380cbba.tar.gz
external_llvm-354362524a72b3fa43a6c09380b7ae3b2380cbba.tar.bz2
[weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-stress/llvm-stress.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index 15f7abf..672e481 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -128,7 +128,7 @@ public:
BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
/// virtual D'tor to silence warnings.
- virtual ~Modifier() {}
+ virtual ~Modifier();
/// Add a new instruction.
virtual void Act() = 0;
@@ -287,6 +287,7 @@ protected:
struct LoadModifier: public Modifier {
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~LoadModifier();
virtual void Act() {
// Try to use predefined pointers. If non exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
@@ -297,6 +298,7 @@ struct LoadModifier: public Modifier {
struct StoreModifier: public Modifier {
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~StoreModifier();
virtual void Act() {
// Try to use predefined pointers. If non exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
@@ -315,6 +317,7 @@ struct StoreModifier: public Modifier {
struct BinModifier: public Modifier {
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~BinModifier();
virtual void Act() {
Value *Val0 = getRandomVal();
@@ -359,6 +362,8 @@ struct BinModifier: public Modifier {
/// Generate constant values.
struct ConstModifier: public Modifier {
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~ConstModifier();
+
virtual void Act() {
Type *Ty = pickType();
@@ -405,6 +410,7 @@ struct ConstModifier: public Modifier {
struct AllocaModifier: public Modifier {
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
+ virtual ~AllocaModifier();
virtual void Act() {
Type *Tp = pickType();
@@ -415,6 +421,7 @@ struct AllocaModifier: public Modifier {
struct ExtractElementModifier: public Modifier {
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
+ virtual ~ExtractElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -428,6 +435,8 @@ struct ExtractElementModifier: public Modifier {
struct ShuffModifier: public Modifier {
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~ShuffModifier();
+
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -456,6 +465,7 @@ struct ShuffModifier: public Modifier {
struct InsertElementModifier: public Modifier {
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
+ virtual ~InsertElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -472,6 +482,8 @@ struct InsertElementModifier: public Modifier {
struct CastModifier: public Modifier {
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~CastModifier();
+
virtual void Act() {
Value *V = getRandomVal();
@@ -558,6 +570,7 @@ struct CastModifier: public Modifier {
struct SelectModifier: public Modifier {
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
+ virtual ~SelectModifier();
virtual void Act() {
// Try a bunch of different select configuration until a valid one is found.
@@ -582,6 +595,8 @@ struct SelectModifier: public Modifier {
struct CmpModifier: public Modifier {
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+ virtual ~CmpModifier();
+
virtual void Act() {
Value *Val0 = getRandomVal();
@@ -607,6 +622,20 @@ struct CmpModifier: public Modifier {
}
};
+// Use out-of-line definitions to prevent weak vtables.
+Modifier::~Modifier() {}
+LoadModifier::~LoadModifier() {}
+StoreModifier::~StoreModifier() {}
+BinModifier::~BinModifier() {}
+ConstModifier::~ConstModifier() {}
+AllocaModifier::~AllocaModifier() {}
+ExtractElementModifier::~ExtractElementModifier() {}
+ShuffModifier::~ShuffModifier() {}
+InsertElementModifier::~InsertElementModifier() {}
+CastModifier::~CastModifier() {}
+SelectModifier::~SelectModifier() {}
+CmpModifier::~CmpModifier() {}
+
void FillFunction(Function *F, Random &R) {
// Create a legal entry block.
BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F);