diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp --- a/llvm/lib/IR/AsmWriter.cpp +++ b/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(I) || isa(I) || isa(I) - || isa(I)) { + // Select, Store, ShuffleVector and CmpXchg always print all types. + if (isa(I) || isa(I) || isa(I) || + isa(I) || isa(I)) { PrintAllTypes = true; } else { for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) { diff --git a/llvm/test/Assembler/opaque-ptr.ll b/llvm/test/Assembler/opaque-ptr.ll --- a/llvm/test/Assembler/opaque-ptr.ll +++ b/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