Lines Matching defs:RMWI
78 AtomicRMWInst *convertAtomicXchgToIntegerType(AtomicRMWInst *RMWI);
103 bool isIdempotentRMW(AtomicRMWInst *RMWI);
104 bool simplifyIdempotentRMW(AtomicRMWInst *RMWI);
185 static unsigned getAtomicOpSize(AtomicRMWInst *RMWI) {
186 const DataLayout &DL = RMWI->getDataLayout();
187 return DL.getTypeStoreSize(RMWI->getValOperand()->getType());
242 auto *RMWI = dyn_cast<AtomicRMWInst>(I);
276 } else if (RMWI) {
277 if (!atomicSizeSupported(TLI, RMWI)) {
278 expandAtomicRMWToLibcall(RMWI);
282 if (TLI->shouldCastAtomicRMWIInIR(RMWI) ==
284 I = RMWI = convertAtomicXchgToIntegerType(RMWI);
312 } else if (RMWI && (isReleaseOrStronger(RMWI->getOrdering()) ||
313 isAcquireOrStronger(RMWI->getOrdering()))) {
314 FenceOrdering = RMWI->getOrdering();
315 RMWI->setOrdering(AtomicOrdering::Monotonic);
339 else if (RMWI)
340 FenceOrdering = RMWI->getOrdering();
358 else if (RMWI) {
364 if (isIdempotentRMW(RMWI) && simplifyIdempotentRMW(RMWI)) {
368 MadeChange |= tryExpandAtomicRMW(RMWI);
480 AtomicExpandImpl::convertAtomicXchgToIntegerType(AtomicRMWInst *RMWI) {
481 assert(RMWI->getOperation() == AtomicRMWInst::Xchg);
483 auto *M = RMWI->getModule();
485 getCorrespondingIntegerType(RMWI->getType(), M->getDataLayout());
487 ReplacementIRBuilder Builder(RMWI, *DL);
489 Value *Addr = RMWI->getPointerOperand();
490 Value *Val = RMWI->getValOperand();
496 RMWI->getAlign(), RMWI->getOrdering(),
497 RMWI->getSyncScopeID());
498 NewRMWI->setVolatile(RMWI->isVolatile());
499 copyMetadataForAtomic(*NewRMWI, *RMWI);
500 LLVM_DEBUG(dbgs() << "Replaced " << *RMWI << " with " << *NewRMWI << "\n");
502 Value *NewRVal = RMWI->getType()->isPointerTy()
503 ? Builder.CreateIntToPtr(NewRMWI, RMWI->getType())
504 : Builder.CreateBitCast(NewRMWI, RMWI->getType());
505 RMWI->replaceAllUsesWith(NewRVal);
506 RMWI->eraseFromParent();
1568 bool AtomicExpandImpl::isIdempotentRMW(AtomicRMWInst *RMWI) {
1569 auto C = dyn_cast<ConstantInt>(RMWI->getValOperand());
1573 AtomicRMWInst::BinOp Op = RMWI->getOperation();
1588 bool AtomicExpandImpl::simplifyIdempotentRMW(AtomicRMWInst *RMWI) {
1589 if (auto ResultingLoad = TLI->lowerIdempotentRMWIntoFencedLoad(RMWI)) {