[PM] Make LowerAtomic a FunctionPass.
Differential Revision: http://reviews.llvm.org/D20025 llvm-svn: 269322
This commit is contained in:
parent
82e7df5a58
commit
851f879f32
|
@ -110,16 +110,27 @@ static bool LowerStoreInst(StoreInst *SI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct LowerAtomic : public BasicBlockPass {
|
struct LowerAtomic : public FunctionPass {
|
||||||
static char ID;
|
static char ID;
|
||||||
LowerAtomic() : BasicBlockPass(ID) {
|
|
||||||
|
LowerAtomic() : FunctionPass(ID) {
|
||||||
initializeLowerAtomicPass(*PassRegistry::getPassRegistry());
|
initializeLowerAtomicPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
bool runOnBasicBlock(BasicBlock &BB) override {
|
|
||||||
if (skipBasicBlock(BB))
|
bool runOnFunction(Function &F) override {
|
||||||
|
if (skipFunction(F))
|
||||||
return false;
|
return false;
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) {
|
for (BasicBlock &BB: F) {
|
||||||
|
Changed |= runOnBasicBlock(BB);
|
||||||
|
}
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool runOnBasicBlock(BasicBlock &BB) {
|
||||||
|
bool Changed = false;
|
||||||
|
for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE;) {
|
||||||
Instruction *Inst = &*DI++;
|
Instruction *Inst = &*DI++;
|
||||||
if (FenceInst *FI = dyn_cast<FenceInst>(Inst))
|
if (FenceInst *FI = dyn_cast<FenceInst>(Inst))
|
||||||
Changed |= LowerFenceInst(FI);
|
Changed |= LowerFenceInst(FI);
|
||||||
|
|
Loading…
Reference in New Issue