Go to the documentation of this file.
22 #define DEBUG_TYPE "loweratomic"
57 Res =
Builder.CreateAdd(Orig, Val);
60 Res =
Builder.CreateSub(Orig, Val);
63 Res =
Builder.CreateAnd(Orig, Val);
69 Res =
Builder.CreateOr(Orig, Val);
72 Res =
Builder.CreateXor(Orig, Val);
91 Res =
Builder.CreateFAdd(Orig, Val);
94 Res =
Builder.CreateFSub(Orig, Val);
119 bool Changed =
false;
121 if (
FenceInst *FI = dyn_cast<FenceInst>(&Inst))
125 else if (
AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(&Inst))
127 else if (
LoadInst *LI = dyn_cast<LoadInst>(&Inst)) {
130 }
else if (
StoreInst *
SI = dyn_cast<StoreInst>(&Inst)) {
139 bool Changed =
false;
164 auto PA = Impl.run(
F, DummyFAM);
165 return !PA.areAllPreserved();
175 "Lower atomic intrinsics to non-atomic form",
false,
false)
A set of analyses that are preserved following a run of a transformation pass.
This class represents lattice values for constants.
A pass that lowers atomic intrinsic into non-atomic intrinsics.
void initializeLowerAtomicLegacyPassPass(PassRegistry &)
BinOp getOperation() const
static bool LowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI)
static bool LowerFenceInst(FenceInst *FI)
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
INITIALIZE_PASS(LowerAtomicLegacyPass, "loweratomic", "Lower atomic intrinsics to non-atomic form", false, false) Pass *llvm
An instruction for ordering other memory operations.
LLVM Basic Block Representation.
Value * getPointerOperand()
Value * getNewValOperand()
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static bool LowerStoreInst(StoreInst *SI)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
@ UMin
*p = old <unsigned v ? old : v
An instruction for storing to memory.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Pass * createLowerAtomicPass()
@ Min
*p = old <signed v ? old : v
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...
Value * getCompareOperand()
static bool LowerAtomicRMWInst(AtomicRMWInst *RMWI)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this load instruction.
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value,...
static bool runOnFunction(Function &F, bool PostInlining)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Value * getPointerOperand()
Pass interface - Implemented by all 'passes'.
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
@ UMax
*p = old >unsigned v ? old : v
LLVM Value Representation.
An instruction that atomically checks whether a specified value is in a memory location,...
static bool runOnBasicBlock(BasicBlock &BB)
static bool lowerAtomics(Function &F)
static bool LowerLoadInst(LoadInst *LI)
@ Max
*p = old >signed v ? old : v