================
@@ -408,7 +409,15 @@ static void emitAtomicCmpXchg(CodeGenFunction &CGF, 
AtomicExpr *E, bool IsWeak,
 
   CGF.Builder.SetInsertPoint(StoreExpectedBB);
   // Update the memory at Expected with Old's value.
-  CGF.Builder.CreateStore(Old, Val1);
+
+  llvm::Type *ExpectedType = ExpectedResult.getElementType();
+  uint64_t OriginalSizeInBits = 
CGF.CGM.getDataLayout().getTypeSizeInBits(ExpectedType);
+  if (OriginalSizeInBits / 8 == Size) {
+    CGF.Builder.CreateStore(Old, ExpectedResult);
+  } else {
+    // How to just store N bytes to ExpectedResult ?
+    CGF.Builder.CreateStore(Old, ExpectedResult);
----------------
ldionne wrote:

@bcardosolopes Hi Bruno! I'm chatting with @huixie90 right now and it seems 
like he needs to store an N bytes temporary object (that was used to perform 
the compare exchange above, but where only the first M bytes are used) into the 
actual result, which has exactly M bytes. We're novices in LLVM IR here -- can 
you suggest someone that would be able to answer a few questions like this one? 
Starting with you since Github suggested you as a reviewer for having modified 
these files recently :)

https://github.com/llvm/llvm-project/pull/78707
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to