Be more consistent in using ValueToValueMapTy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116387 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-10-13 01:36:30 +00:00
parent 6932643a37
commit 1ed219a9d2
11 changed files with 44 additions and 43 deletions

View File

@ -22,6 +22,7 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/Support/ValueHandle.h" #include "llvm/Support/ValueHandle.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
namespace llvm { namespace llvm {
@ -46,7 +47,7 @@ class AllocaInst;
/// CloneModule - Return an exact copy of the specified module /// CloneModule - Return an exact copy of the specified module
/// ///
Module *CloneModule(const Module *M); Module *CloneModule(const Module *M);
Module *CloneModule(const Module *M, ValueMap<const Value*, Value*> &VMap); Module *CloneModule(const Module *M, ValueToValueMapTy &VMap);
/// ClonedCodeInfo - This struct can be used to capture information about code /// ClonedCodeInfo - This struct can be used to capture information about code
/// being cloned, while it is being cloned. /// being cloned, while it is being cloned.
@ -102,7 +103,7 @@ struct ClonedCodeInfo {
/// parameter. /// parameter.
/// ///
BasicBlock *CloneBasicBlock(const BasicBlock *BB, BasicBlock *CloneBasicBlock(const BasicBlock *BB,
ValueMap<const Value*, Value*> &VMap, ValueToValueMapTy &VMap,
const Twine &NameSuffix = "", Function *F = 0, const Twine &NameSuffix = "", Function *F = 0,
ClonedCodeInfo *CodeInfo = 0); ClonedCodeInfo *CodeInfo = 0);
@ -110,7 +111,7 @@ BasicBlock *CloneBasicBlock(const BasicBlock *BB,
/// CloneLoop - Clone Loop. Clone dominator info for loop insiders. Populate /// CloneLoop - Clone Loop. Clone dominator info for loop insiders. Populate
/// VMap using old blocks to new blocks mapping. /// VMap using old blocks to new blocks mapping.
Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI, Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI,
ValueMap<const Value *, Value *> &VMap, Pass *P); ValueToValueMapTy &VMap, Pass *P);
/// CloneFunction - Return a copy of the specified function, but without /// CloneFunction - Return a copy of the specified function, but without
/// embedding the function into another module. Also, any references specified /// embedding the function into another module. Also, any references specified
@ -125,14 +126,14 @@ Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI,
/// mappings. /// mappings.
/// ///
Function *CloneFunction(const Function *F, Function *CloneFunction(const Function *F,
ValueMap<const Value*, Value*> &VMap, ValueToValueMapTy &VMap,
bool ModuleLevelChanges, bool ModuleLevelChanges,
ClonedCodeInfo *CodeInfo = 0); ClonedCodeInfo *CodeInfo = 0);
/// CloneFunction - Version of the function that doesn't need the VMap. /// CloneFunction - Version of the function that doesn't need the VMap.
/// ///
inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){ inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
return CloneFunction(F, VMap, CodeInfo); return CloneFunction(F, VMap, CodeInfo);
} }
@ -146,7 +147,7 @@ inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){
/// mappings. /// mappings.
/// ///
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
ValueMap<const Value*, Value*> &VMap, ValueToValueMapTy &VMap,
bool ModuleLevelChanges, bool ModuleLevelChanges,
SmallVectorImpl<ReturnInst*> &Returns, SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "", const char *NameSuffix = "",
@ -164,7 +165,7 @@ void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
/// mappings. /// mappings.
/// ///
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
ValueMap<const Value*, Value*> &VMap, ValueToValueMapTy &VMap,
bool ModuleLevelChanges, bool ModuleLevelChanges,
SmallVectorImpl<ReturnInst*> &Returns, SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "", const char *NameSuffix = "",

View File

@ -67,7 +67,7 @@ Function* PartialInliner::unswitchFunction(Function* F) {
return 0; return 0;
// Clone the function, so that we can hack away on it. // Clone the function, so that we can hack away on it.
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Function* duplicateFunction = CloneFunction(F, VMap, Function* duplicateFunction = CloneFunction(F, VMap,
/*ModuleLevelChanges=*/false); /*ModuleLevelChanges=*/false);
duplicateFunction->setLinkage(GlobalValue::InternalLinkage); duplicateFunction->setLinkage(GlobalValue::InternalLinkage);

View File

@ -60,10 +60,10 @@ INITIALIZE_PASS(PartSpec, "partialspecialization",
// a call to the specialized function. Returns the specialized function // a call to the specialized function. Returns the specialized function
static Function* static Function*
SpecializeFunction(Function* F, SpecializeFunction(Function* F,
ValueMap<const Value*, Value*>& replacements) { ValueToValueMapTy& replacements) {
// arg numbers of deleted arguments // arg numbers of deleted arguments
DenseMap<unsigned, const Argument*> deleted; DenseMap<unsigned, const Argument*> deleted;
for (ValueMap<const Value*, Value*>::iterator for (ValueToValueMapTy::iterator
repb = replacements.begin(), repe = replacements.end(); repb = replacements.begin(), repe = replacements.end();
repb != repe; ++repb) { repb != repe; ++repb) {
Argument const *arg = cast<const Argument>(repb->first); Argument const *arg = cast<const Argument>(repb->first);
@ -164,7 +164,7 @@ bool PartSpec::runOnModule(Module &M) {
// leave the original function dead and removable. // leave the original function dead and removable.
if (cost.isAlways() || if (cost.isAlways() ||
(cost.isVariable() && cost.getValue() < bonus)) { (cost.isVariable() && cost.getValue() < bonus)) {
ValueMap<const Value*, Value*> m; ValueToValueMapTy m;
Function::arg_iterator arg = F.arg_begin(); Function::arg_iterator arg = F.arg_begin();
for (int y = 0; y < interestingArgs[x]; ++y) for (int y = 0; y < interestingArgs[x]; ++y)
++arg; ++arg;

View File

@ -461,10 +461,10 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
// current values into those specified by VMap. // current values into those specified by VMap.
// //
static inline void RemapInstruction(Instruction *I, static inline void RemapInstruction(Instruction *I,
ValueMap<const Value *, Value*> &VMap) { ValueToValueMapTy &VMap) {
for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) { for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
Value *Op = I->getOperand(op); Value *Op = I->getOperand(op);
ValueMap<const Value *, Value*>::iterator It = VMap.find(Op); ValueToValueMapTy::iterator It = VMap.find(Op);
if (It != VMap.end()) Op = It->second; if (It != VMap.end()) Op = It->second;
I->setOperand(op, Op); I->setOperand(op, Op);
} }
@ -472,7 +472,7 @@ static inline void RemapInstruction(Instruction *I,
/// CloneLoop - Recursively clone the specified loop and all of its children, /// CloneLoop - Recursively clone the specified loop and all of its children,
/// mapping the blocks with the specified map. /// mapping the blocks with the specified map.
static Loop *CloneLoop(Loop *L, Loop *PL, ValueMap<const Value*, Value*> &VM, static Loop *CloneLoop(Loop *L, Loop *PL, ValueToValueMapTy &VM,
LoopInfo *LI, LPPassManager *LPM) { LoopInfo *LI, LPPassManager *LPM) {
Loop *New = new Loop(); Loop *New = new Loop();
LPM->insertLoop(New, PL); LPM->insertLoop(New, PL);
@ -616,7 +616,7 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// the loop preheader and exit blocks), keeping track of the mapping between // the loop preheader and exit blocks), keeping track of the mapping between
// the instructions and blocks. // the instructions and blocks.
NewBlocks.reserve(LoopBlocks.size()); NewBlocks.reserve(LoopBlocks.size());
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) { for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
BasicBlock *NewBB = CloneBasicBlock(LoopBlocks[i], VMap, ".us", F); BasicBlock *NewBB = CloneBasicBlock(LoopBlocks[i], VMap, ".us", F);
NewBlocks.push_back(NewBB); NewBlocks.push_back(NewBB);
@ -654,7 +654,7 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
for (BasicBlock::iterator I = ExitSucc->begin(); isa<PHINode>(I); ++I) { for (BasicBlock::iterator I = ExitSucc->begin(); isa<PHINode>(I); ++I) {
PN = cast<PHINode>(I); PN = cast<PHINode>(I);
Value *V = PN->getIncomingValueForBlock(ExitBlocks[i]); Value *V = PN->getIncomingValueForBlock(ExitBlocks[i]);
ValueMap<const Value *, Value*>::iterator It = VMap.find(V); ValueToValueMapTy::iterator It = VMap.find(V);
if (It != VMap.end()) V = It->second; if (It != VMap.end()) V = It->second;
PN->addIncoming(V, NewExit); PN->addIncoming(V, NewExit);
} }

View File

@ -22,12 +22,12 @@ using namespace llvm;
/// CloneDominatorInfo - Clone basicblock's dominator tree and, if available, /// CloneDominatorInfo - Clone basicblock's dominator tree and, if available,
/// dominance info. It is expected that basic block is already cloned. /// dominance info. It is expected that basic block is already cloned.
static void CloneDominatorInfo(BasicBlock *BB, static void CloneDominatorInfo(BasicBlock *BB,
ValueMap<const Value *, Value *> &VMap, ValueToValueMapTy &VMap,
DominatorTree *DT, DominatorTree *DT,
DominanceFrontier *DF) { DominanceFrontier *DF) {
assert (DT && "DominatorTree is not available"); assert (DT && "DominatorTree is not available");
ValueMap<const Value *, Value*>::iterator BI = VMap.find(BB); ValueToValueMapTy::iterator BI = VMap.find(BB);
assert (BI != VMap.end() && "BasicBlock clone is missing"); assert (BI != VMap.end() && "BasicBlock clone is missing");
BasicBlock *NewBB = cast<BasicBlock>(BI->second); BasicBlock *NewBB = cast<BasicBlock>(BI->second);
@ -42,7 +42,7 @@ static void CloneDominatorInfo(BasicBlock *BB,
// NewBB's dominator is either BB's dominator or BB's dominator's clone. // NewBB's dominator is either BB's dominator or BB's dominator's clone.
BasicBlock *NewBBDom = BBDom; BasicBlock *NewBBDom = BBDom;
ValueMap<const Value *, Value*>::iterator BBDomI = VMap.find(BBDom); ValueToValueMapTy::iterator BBDomI = VMap.find(BBDom);
if (BBDomI != VMap.end()) { if (BBDomI != VMap.end()) {
NewBBDom = cast<BasicBlock>(BBDomI->second); NewBBDom = cast<BasicBlock>(BBDomI->second);
if (!DT->getNode(NewBBDom)) if (!DT->getNode(NewBBDom))
@ -59,7 +59,7 @@ static void CloneDominatorInfo(BasicBlock *BB,
for (DominanceFrontier::DomSetType::iterator I = S.begin(), E = S.end(); for (DominanceFrontier::DomSetType::iterator I = S.begin(), E = S.end();
I != E; ++I) { I != E; ++I) {
BasicBlock *DB = *I; BasicBlock *DB = *I;
ValueMap<const Value*, Value*>::iterator IDM = VMap.find(DB); ValueToValueMapTy::iterator IDM = VMap.find(DB);
if (IDM != VMap.end()) if (IDM != VMap.end())
NewDFSet.insert(cast<BasicBlock>(IDM->second)); NewDFSet.insert(cast<BasicBlock>(IDM->second));
else else
@ -73,7 +73,7 @@ static void CloneDominatorInfo(BasicBlock *BB,
/// CloneLoop - Clone Loop. Clone dominator info. Populate VMap /// CloneLoop - Clone Loop. Clone dominator info. Populate VMap
/// using old blocks to new blocks mapping. /// using old blocks to new blocks mapping.
Loop *llvm::CloneLoop(Loop *OrigL, LPPassManager *LPM, LoopInfo *LI, Loop *llvm::CloneLoop(Loop *OrigL, LPPassManager *LPM, LoopInfo *LI,
ValueMap<const Value *, Value *> &VMap, Pass *P) { ValueToValueMapTy &VMap, Pass *P) {
DominatorTree *DT = NULL; DominatorTree *DT = NULL;
DominanceFrontier *DF = NULL; DominanceFrontier *DF = NULL;
@ -134,7 +134,7 @@ Loop *llvm::CloneLoop(Loop *OrigL, LPPassManager *LPM, LoopInfo *LI,
for (unsigned index = 0, num_ops = Insn->getNumOperands(); for (unsigned index = 0, num_ops = Insn->getNumOperands();
index != num_ops; ++index) { index != num_ops; ++index) {
Value *Op = Insn->getOperand(index); Value *Op = Insn->getOperand(index);
ValueMap<const Value *, Value *>::iterator OpItr = VMap.find(Op); ValueToValueMapTy::iterator OpItr = VMap.find(Op);
if (OpItr != VMap.end()) if (OpItr != VMap.end())
Insn->setOperand(index, OpItr->second); Insn->setOperand(index, OpItr->second);
} }

View File

@ -170,7 +170,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
/// some edges of the callgraph may remain. /// some edges of the callgraph may remain.
static void UpdateCallGraphAfterInlining(CallSite CS, static void UpdateCallGraphAfterInlining(CallSite CS,
Function::iterator FirstNewBlock, Function::iterator FirstNewBlock,
ValueMap<const Value*, Value*> &VMap, ValueToValueMapTy &VMap,
InlineFunctionInfo &IFI) { InlineFunctionInfo &IFI) {
CallGraph &CG = *IFI.CG; CallGraph &CG = *IFI.CG;
const Function *Caller = CS.getInstruction()->getParent()->getParent(); const Function *Caller = CS.getInstruction()->getParent()->getParent();
@ -193,7 +193,7 @@ static void UpdateCallGraphAfterInlining(CallSite CS,
for (; I != E; ++I) { for (; I != E; ++I) {
const Value *OrigCall = I->first; const Value *OrigCall = I->first;
ValueMap<const Value*, Value*>::iterator VMI = VMap.find(OrigCall); ValueToValueMapTy::iterator VMI = VMap.find(OrigCall);
// Only copy the edge if the call was inlined! // Only copy the edge if the call was inlined!
if (VMI == VMap.end() || VMI->second == 0) if (VMI == VMap.end() || VMI->second == 0)
continue; continue;
@ -287,7 +287,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
Function::iterator FirstNewBlock; Function::iterator FirstNewBlock;
{ // Scope to destroy VMap after cloning. { // Scope to destroy VMap after cloning.
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
assert(CalledFunc->arg_size() == CS.arg_size() && assert(CalledFunc->arg_size() == CS.arg_size() &&
"No varargs calls can be inlined!"); "No varargs calls can be inlined!");

View File

@ -40,10 +40,10 @@ STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)");
/// RemapInstruction - Convert the instruction operands from referencing the /// RemapInstruction - Convert the instruction operands from referencing the
/// current values into those specified by VMap. /// current values into those specified by VMap.
static inline void RemapInstruction(Instruction *I, static inline void RemapInstruction(Instruction *I,
ValueMap<const Value *, Value*> &VMap) { ValueToValueMapTy &VMap) {
for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) { for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
Value *Op = I->getOperand(op); Value *Op = I->getOperand(op);
ValueMap<const Value *, Value*>::iterator It = VMap.find(Op); ValueToValueMapTy::iterator It = VMap.find(Op);
if (It != VMap.end()) if (It != VMap.end())
I->setOperand(op, It->second); I->setOperand(op, It->second);
} }
@ -189,7 +189,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM)
// For the first iteration of the loop, we should use the precloned values for // For the first iteration of the loop, we should use the precloned values for
// PHI nodes. Insert associations now. // PHI nodes. Insert associations now.
typedef ValueMap<const Value*, Value*> ValueToValueMapTy;
ValueToValueMapTy LastValueMap; ValueToValueMapTy LastValueMap;
std::vector<PHINode*> OrigPHINode; std::vector<PHINode*> OrigPHINode;
for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) { for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
@ -274,7 +273,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM)
for (unsigned i = 0; i < NewBlocks.size(); ++i) for (unsigned i = 0; i < NewBlocks.size(); ++i)
for (BasicBlock::iterator I = NewBlocks[i]->begin(), for (BasicBlock::iterator I = NewBlocks[i]->begin(),
E = NewBlocks[i]->end(); I != E; ++I) E = NewBlocks[i]->end(); I != E; ++I)
RemapInstruction(I, LastValueMap); ::RemapInstruction(I, LastValueMap);
} }
// The latch block exits the loop. If there are any PHI nodes in the // The latch block exits the loop. If there are any PHI nodes in the

View File

@ -17,6 +17,7 @@
#define BUGDRIVER_H #define BUGDRIVER_H
#include "llvm/ADT/ValueMap.h" #include "llvm/ADT/ValueMap.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <vector> #include <vector>
#include <string> #include <string>
@ -322,7 +323,7 @@ void DeleteFunctionBody(Function *F);
/// module, split the functions OUT of the specified module, and place them in /// module, split the functions OUT of the specified module, and place them in
/// the new module. /// the new module.
Module *SplitFunctionsOutOfModule(Module *M, const std::vector<Function*> &F, Module *SplitFunctionsOutOfModule(Module *M, const std::vector<Function*> &F,
ValueMap<const Value*, Value*> &VMap); ValueToValueMapTy &VMap);
} // End llvm namespace } // End llvm namespace

View File

@ -130,7 +130,7 @@ bool
ReduceCrashingGlobalVariables::TestGlobalVariables( ReduceCrashingGlobalVariables::TestGlobalVariables(
std::vector<GlobalVariable*> &GVs) { std::vector<GlobalVariable*> &GVs) {
// Clone the program to try hacking it apart... // Clone the program to try hacking it apart...
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *M = CloneModule(BD.getProgram(), VMap); Module *M = CloneModule(BD.getProgram(), VMap);
// Convert list to set for fast lookup... // Convert list to set for fast lookup...
@ -204,7 +204,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
return false; return false;
// Clone the program to try hacking it apart... // Clone the program to try hacking it apart...
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *M = CloneModule(BD.getProgram(), VMap); Module *M = CloneModule(BD.getProgram(), VMap);
// Convert list to set for fast lookup... // Convert list to set for fast lookup...
@ -271,7 +271,7 @@ namespace {
bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) { bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
// Clone the program to try hacking it apart... // Clone the program to try hacking it apart...
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *M = CloneModule(BD.getProgram(), VMap); Module *M = CloneModule(BD.getProgram(), VMap);
// Convert list to set for fast lookup... // Convert list to set for fast lookup...
@ -381,7 +381,7 @@ namespace {
bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*> bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*>
&Insts) { &Insts) {
// Clone the program to try hacking it apart... // Clone the program to try hacking it apart...
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *M = CloneModule(BD.getProgram(), VMap); Module *M = CloneModule(BD.getProgram(), VMap);
// Convert list to set for fast lookup... // Convert list to set for fast lookup...

View File

@ -193,7 +193,7 @@ static Constant *GetTorInit(std::vector<std::pair<Function*, int> > &TorList) {
/// static ctors/dtors, we need to add an llvm.global_[cd]tors global to M2, and /// static ctors/dtors, we need to add an llvm.global_[cd]tors global to M2, and
/// prune appropriate entries out of M1s list. /// prune appropriate entries out of M1s list.
static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2, static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2,
ValueMap<const Value*, Value*> &VMap) { ValueToValueMapTy &VMap) {
GlobalVariable *GV = M1->getNamedGlobal(GlobalName); GlobalVariable *GV = M1->getNamedGlobal(GlobalName);
if (!GV || GV->isDeclaration() || GV->hasLocalLinkage() || if (!GV || GV->isDeclaration() || GV->hasLocalLinkage() ||
!GV->use_empty()) return; !GV->use_empty()) return;
@ -256,7 +256,7 @@ static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2,
Module * Module *
llvm::SplitFunctionsOutOfModule(Module *M, llvm::SplitFunctionsOutOfModule(Module *M,
const std::vector<Function*> &F, const std::vector<Function*> &F,
ValueMap<const Value*, Value*> &VMap) { ValueToValueMapTy &VMap) {
// Make sure functions & globals are all external so that linkage // Make sure functions & globals are all external so that linkage
// between the two modules will work. // between the two modules will work.
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
@ -268,7 +268,7 @@ llvm::SplitFunctionsOutOfModule(Module *M,
I->setLinkage(GlobalValue::ExternalLinkage); I->setLinkage(GlobalValue::ExternalLinkage);
} }
ValueMap<const Value*, Value*> NewVMap; ValueToValueMapTy NewVMap;
Module *New = CloneModule(M, NewVMap); Module *New = CloneModule(M, NewVMap);
// Make sure global initializers exist only in the safe module (CBE->.so) // Make sure global initializers exist only in the safe module (CBE->.so)

View File

@ -261,7 +261,7 @@ bool ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function*> &Funcs,
// a function, we want to continue with the original function. Otherwise // a function, we want to continue with the original function. Otherwise
// we can conclude that a function triggers the bug when in fact one // we can conclude that a function triggers the bug when in fact one
// needs a larger set of original functions to do so. // needs a larger set of original functions to do so.
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *Clone = CloneModule(BD.getProgram(), VMap); Module *Clone = CloneModule(BD.getProgram(), VMap);
Module *Orig = BD.swapProgramIn(Clone); Module *Orig = BD.swapProgramIn(Clone);
@ -310,7 +310,7 @@ static bool ExtractLoops(BugDriver &BD,
while (1) { while (1) {
if (BugpointIsInterrupted) return MadeChange; if (BugpointIsInterrupted) return MadeChange;
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap); Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap);
Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize, Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
MiscompiledFunctions, MiscompiledFunctions,
@ -476,7 +476,7 @@ bool ReduceMiscompiledBlocks::TestFuncs(const std::vector<BasicBlock*> &BBs,
outs() << '\n'; outs() << '\n';
// Split the module into the two halves of the program we want. // Split the module into the two halves of the program we want.
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *Clone = CloneModule(BD.getProgram(), VMap); Module *Clone = CloneModule(BD.getProgram(), VMap);
Module *Orig = BD.swapProgramIn(Clone); Module *Orig = BD.swapProgramIn(Clone);
std::vector<Function*> FuncsOnClone; std::vector<Function*> FuncsOnClone;
@ -551,7 +551,7 @@ static bool ExtractBlocks(BugDriver &BD,
return false; return false;
} }
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *ProgClone = CloneModule(BD.getProgram(), VMap); Module *ProgClone = CloneModule(BD.getProgram(), VMap);
Module *ToExtract = SplitFunctionsOutOfModule(ProgClone, Module *ToExtract = SplitFunctionsOutOfModule(ProgClone,
MiscompiledFunctions, MiscompiledFunctions,
@ -738,7 +738,7 @@ void BugDriver::debugMiscompilation(std::string *Error) {
// Output a bunch of bitcode files for the user... // Output a bunch of bitcode files for the user...
outs() << "Outputting reduced bitcode files which expose the problem:\n"; outs() << "Outputting reduced bitcode files which expose the problem:\n";
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *ToNotOptimize = CloneModule(getProgram(), VMap); Module *ToNotOptimize = CloneModule(getProgram(), VMap);
Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize, Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
MiscompiledFunctions, MiscompiledFunctions,
@ -1011,7 +1011,7 @@ bool BugDriver::debugCodeGenerator(std::string *Error) {
return true; return true;
// Split the module into the two halves of the program we want. // Split the module into the two halves of the program we want.
ValueMap<const Value*, Value*> VMap; ValueToValueMapTy VMap;
Module *ToNotCodeGen = CloneModule(getProgram(), VMap); Module *ToNotCodeGen = CloneModule(getProgram(), VMap);
Module *ToCodeGen = SplitFunctionsOutOfModule(ToNotCodeGen, Funcs, VMap); Module *ToCodeGen = SplitFunctionsOutOfModule(ToNotCodeGen, Funcs, VMap);