[PATCH] D129276: [IR][OpaquePointers] Properly print cmpxchg with pointer operands.

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 07:19:07 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26f369393d4e: [IR][OpaquePointers] Properly print cmpxchg with pointer operands. (authored by dantrushin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129276/new/

https://reviews.llvm.org/D129276

Files:
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Assembler/opaque-ptr.ll


Index: llvm/test/Assembler/opaque-ptr.ll
===================================================================
--- llvm/test/Assembler/opaque-ptr.ll
+++ llvm/test/Assembler/opaque-ptr.ll
@@ -107,6 +107,14 @@
     ret void
 }
 
+; CHECK: define void @cmpxchg_ptr(ptr %p, ptr %a, ptr %b)
+; CHECK:     %val_success = cmpxchg ptr %p, ptr %a, ptr %b acq_rel monotonic
+; CHECK:     ret void
+define void @cmpxchg_ptr(ptr %p, ptr %a, ptr %b) {
+    %val_success = cmpxchg ptr %p, ptr %a, ptr %b acq_rel monotonic
+    ret void
+}
+
 ; CHECK: define void @atomicrmw(ptr %a, i32 %i)
 ; CHECK:     %b = atomicrmw add ptr %a, i32 %i acquire
 ; CHECK:     ret void
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -4295,9 +4295,9 @@
     bool PrintAllTypes = false;
     Type *TheType = Operand->getType();
 
-    // Select, Store and ShuffleVector always print all types.
-    if (isa<SelectInst>(I) || isa<StoreInst>(I) || isa<ShuffleVectorInst>(I)
-        || isa<ReturnInst>(I)) {
+    // Select, Store, ShuffleVector and CmpXchg always print all types.
+    if (isa<SelectInst>(I) || isa<StoreInst>(I) || isa<ShuffleVectorInst>(I) ||
+        isa<ReturnInst>(I) || isa<AtomicCmpXchgInst>(I)) {
       PrintAllTypes = true;
     } else {
       for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129276.442905.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220707/cf6499da/attachment.bin>


More information about the llvm-commits mailing list