[llvm] 109b508 - AtomicExpand: Add assert that atomicrmw is an xchg

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 23:55:58 PDT 2024


Author: Matt Arsenault
Date: 2024-08-14T10:55:52+04:00
New Revision: 109b50808f72c228518766c3b384dd14e0dcf4ee

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

LOG: AtomicExpand: Add assert that atomicrmw is an xchg

It turns out it's trivial to hit this path with any rmw
operation.

Added: 
    

Modified: 
    llvm/lib/CodeGen/AtomicExpandPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index d8f33c42a8a14..39a705599f90c 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -441,6 +441,8 @@ LoadInst *AtomicExpandImpl::convertAtomicLoadToIntegerType(LoadInst *LI) {
 
 AtomicRMWInst *
 AtomicExpandImpl::convertAtomicXchgToIntegerType(AtomicRMWInst *RMWI) {
+  assert(RMWI->getOperation() == AtomicRMWInst::Xchg);
+
   auto *M = RMWI->getModule();
   Type *NewTy =
       getCorrespondingIntegerType(RMWI->getType(), M->getDataLayout());


        


More information about the llvm-commits mailing list