[llvm] r269322 - [PM] Make LowerAtomic a FunctionPass.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 11:49:32 PDT 2016
Author: davide
Date: Thu May 12 13:49:32 2016
New Revision: 269322
URL: http://llvm.org/viewvc/llvm-project?rev=269322&view=rev
Log:
[PM] Make LowerAtomic a FunctionPass.
Differential Revision: http://reviews.llvm.org/D20025
Modified:
llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp?rev=269322&r1=269321&r2=269322&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp Thu May 12 13:49:32 2016
@@ -110,16 +110,27 @@ static bool LowerStoreInst(StoreInst *SI
}
namespace {
- struct LowerAtomic : public BasicBlockPass {
+ struct LowerAtomic : public FunctionPass {
static char ID;
- LowerAtomic() : BasicBlockPass(ID) {
+
+ LowerAtomic() : FunctionPass(ID) {
initializeLowerAtomicPass(*PassRegistry::getPassRegistry());
}
- bool runOnBasicBlock(BasicBlock &BB) override {
- if (skipBasicBlock(BB))
+
+ bool runOnFunction(Function &F) override {
+ if (skipFunction(F))
return 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++;
if (FenceInst *FI = dyn_cast<FenceInst>(Inst))
Changed |= LowerFenceInst(FI);
More information about the llvm-commits
mailing list