Skip to content

Commit 851f879

Browse files
committedMay 12, 2016
[PM] Make LowerAtomic a FunctionPass.
Differential Revision: http://reviews.llvm.org/D20025 llvm-svn: 269322
1 parent 82e7df5 commit 851f879

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed
 

‎llvm/lib/Transforms/Scalar/LowerAtomic.cpp

+16-5
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,27 @@ static bool LowerStoreInst(StoreInst *SI) {
110110
}
111111

112112
namespace {
113-
struct LowerAtomic : public BasicBlockPass {
113+
struct LowerAtomic : public FunctionPass {
114114
static char ID;
115-
LowerAtomic() : BasicBlockPass(ID) {
115+
116+
LowerAtomic() : FunctionPass(ID) {
116117
initializeLowerAtomicPass(*PassRegistry::getPassRegistry());
117118
}
118-
bool runOnBasicBlock(BasicBlock &BB) override {
119-
if (skipBasicBlock(BB))
119+
120+
bool runOnFunction(Function &F) override {
121+
if (skipFunction(F))
120122
return false;
121123
bool Changed = false;
122-
for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) {
124+
for (BasicBlock &BB: F) {
125+
Changed |= runOnBasicBlock(BB);
126+
}
127+
return Changed;
128+
}
129+
130+
private:
131+
bool runOnBasicBlock(BasicBlock &BB) {
132+
bool Changed = false;
133+
for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE;) {
123134
Instruction *Inst = &*DI++;
124135
if (FenceInst *FI = dyn_cast<FenceInst>(Inst))
125136
Changed |= LowerFenceInst(FI);

0 commit comments

Comments
 (0)
Please sign in to comment.