[llvm] [TSan] Fix atomicrmw xchg with pointer and floats (PR #85228)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 01:22:00 PDT 2024
================
@@ -752,11 +752,12 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I, const DataLayout &DL) {
const unsigned ByteSize = 1U << Idx;
const unsigned BitSize = ByteSize * 8;
Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
- Value *Args[] = {Addr,
- IRB.CreateIntCast(RMWI->getValOperand(), Ty, false),
+ Value *Val = RMWI->getValOperand();
+ Value *Args[] = {Addr, IRB.CreateBitOrPointerCast(Val, Ty),
createOrdering(&IRB, RMWI->getOrdering())};
- CallInst *C = CallInst::Create(F, Args);
- ReplaceInstWithInst(I, C);
+ Value *C = IRB.CreateCall(F, Args);
+ I->replaceAllUsesWith(IRB.CreateBitOrPointerCast(C, Val->getType()));
----------------
nikic wrote:
Converted the remaining uses in https://github.com/llvm/llvm-project/commit/8a237ab7d9022d24441544ba25be480f0c944f5a.
https://github.com/llvm/llvm-project/pull/85228
More information about the llvm-commits
mailing list