[llvm] [TSan] Fix atomicrmw xchg with pointer and floats (PR #85228)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 15:54:53 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()));
----------------
vitalybuka wrote:
Thanks!
https://github.com/llvm/llvm-project/pull/85228
More information about the llvm-commits
mailing list