23#define DEBUG_TYPE "lower-atomic"
36 SI->setAtomic(AtomicOrdering::NotAtomic);
43 if (
FenceInst *FI = dyn_cast<FenceInst>(&Inst))
47 else if (
AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(&Inst))
49 else if (
LoadInst *LI = dyn_cast<LoadInst>(&Inst)) {
52 }
else if (
StoreInst *SI = dyn_cast<StoreInst>(&Inst)) {
86 auto PA = Impl.run(
F, DummyFAM);
87 return !PA.areAllPreserved();
95char LowerAtomicLegacyPass::ID = 0;
97 "Lower atomic intrinsics to non-atomic form",
false,
false)
static bool runOnFunction(Function &F, bool PostInlining)
static bool LowerStoreInst(StoreInst *SI)
static bool LowerLoadInst(LoadInst *LI)
static bool LowerFenceInst(FenceInst *FI)
static bool runOnBasicBlock(BasicBlock &BB)
static bool lowerAtomics(Function &F)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
A container for analyses that lazily runs them and caches their results.
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
LLVM Basic Block Representation.
An instruction for ordering other memory operations.
FunctionPass class - This class is used to implement most global optimizations.
InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
An instruction for reading from memory.
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this load instruction.
A pass that lowers atomic intrinsic into non-atomic intrinsics.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Pass interface - Implemented by all 'passes'.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
An instruction for storing to memory.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Pass * createLowerAtomicPass()
bool lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI)
Convert the given Cmpxchg into primitive load and compare.
bool lowerAtomicRMWInst(AtomicRMWInst *RMWI)
Convert the given RMWI into primitive load and stores, assuming that doing so is legal.
void initializeLowerAtomicLegacyPassPass(PassRegistry &)