- // XXX-comment: Delay dealing with relaxed loads in this function to avoid
- // further changes done by other passes (e.g., SimplifyCFG).
-
- // Collect all the relaxed loads.
- SmallVector<LoadInst*, 1> MonotonicLoadInsts;
- for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
- if (I->isAtomic()) {
- switch (I->getOpcode()) {
- case Instruction::Load: {
- auto* LI = dyn_cast<LoadInst>(&*I);
- if (LI->getOrdering() == Monotonic) {
- MonotonicLoadInsts.push_back(LI);
- }
- break;
- }
- default: {
- break;
- }
- }
- }
- }
- bool EverMadeChange =
- AddsFakeConditionalBranchAfterMonotonicLoads(MonotonicLoadInsts);