OLD | NEW |
1 //===- LowerAtomic.cpp - Lower atomic intrinsics --------------------------===// | 1 //===- LowerAtomic.cpp - Lower atomic intrinsics --------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This pass lowers atomic intrinsics to non-atomic form for use in a known | 10 // This pass lowers atomic intrinsics to non-atomic form for use in a known |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool Changed = false; | 115 bool Changed = false; |
116 for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) { | 116 for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) { |
117 Instruction *Inst = DI++; | 117 Instruction *Inst = DI++; |
118 if (FenceInst *FI = dyn_cast<FenceInst>(Inst)) | 118 if (FenceInst *FI = dyn_cast<FenceInst>(Inst)) |
119 Changed |= LowerFenceInst(FI); | 119 Changed |= LowerFenceInst(FI); |
120 else if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(Inst)) | 120 else if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(Inst)) |
121 Changed |= LowerAtomicCmpXchgInst(CXI); | 121 Changed |= LowerAtomicCmpXchgInst(CXI); |
122 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(Inst)) | 122 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(Inst)) |
123 Changed |= LowerAtomicRMWInst(RMWI); | 123 Changed |= LowerAtomicRMWInst(RMWI); |
124 else if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { | 124 else if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { |
| 125 LI->setVolatile(false); |
125 if (LI->isAtomic()) | 126 if (LI->isAtomic()) |
126 LowerLoadInst(LI); | 127 LowerLoadInst(LI); |
127 } else if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { | 128 } else if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { |
| 129 SI->setVolatile(false); |
128 if (SI->isAtomic()) | 130 if (SI->isAtomic()) |
129 LowerStoreInst(SI); | 131 LowerStoreInst(SI); |
130 } | 132 } |
131 } | 133 } |
132 return Changed; | 134 return Changed; |
133 } | 135 } |
134 }; | 136 }; |
135 } | 137 } |
136 | 138 |
137 char LowerAtomic::ID = 0; | 139 char LowerAtomic::ID = 0; |
138 INITIALIZE_PASS(LowerAtomic, "loweratomic", | 140 INITIALIZE_PASS(LowerAtomic, "loweratomic", |
139 "Lower atomic intrinsics to non-atomic form", | 141 "Lower atomic intrinsics to non-atomic form", |
140 false, false) | 142 false, false) |
141 | 143 |
142 Pass *llvm::createLowerAtomicPass() { return new LowerAtomic(); } | 144 Pass *llvm::createLowerAtomicPass() { return new LowerAtomic(); } |
OLD | NEW |