[llvm] e2bff1e - [X86] Fix atomic rmw intrinsic expansion for non-opaque pointers

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 06:44:16 PST 2022


Author: Benjamin Kramer
Date: 2022-11-20T15:39:30+01:00
New Revision: e2bff1e489fbc2488dde94bc02dcfc767fca2443

URL: https://github.com/llvm/llvm-project/commit/e2bff1e489fbc2488dde94bc02dcfc767fca2443
DIFF: https://github.com/llvm/llvm-project/commit/e2bff1e489fbc2488dde94bc02dcfc767fca2443.diff

LOG: [X86] Fix atomic rmw intrinsic expansion for non-opaque pointers

This is a bit annoying, but there are still users out there that got
broken by this (this time it was numba). We need to keep some barebones
support around until non-opaque pointers are completely gone.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 89eeab5b3114..e9d41405643c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -31490,9 +31490,10 @@ void X86TargetLowering::emitCmpArithAtomicRMWIntrinsic(
   }
   Function *CmpArith =
       Intrinsic::getDeclaration(AI->getModule(), IID, AI->getType());
-  Value *Call = Builder.CreateCall(CmpArith, {AI->getPointerOperand(),
-                                              AI->getValOperand(),
-                                              Builder.getInt32((unsigned)CC)});
+  Value *Addr = Builder.CreatePointerCast(AI->getPointerOperand(),
+                                          Type::getInt8PtrTy(Ctx));
+  Value *Call = Builder.CreateCall(
+      CmpArith, {Addr, AI->getValOperand(), Builder.getInt32((unsigned)CC)});
   Value *Result = Builder.CreateTrunc(Call, Type::getInt1Ty(Ctx));
   ICI->replaceAllUsesWith(Result);
   ICI->eraseFromParent();


        


More information about the llvm-commits mailing list