[PATCH] Bugfix for Codegen of atomic load/store ops.

Alexey Bataev a.bataev at hotmail.com
Fri Dec 12 04:05:10 PST 2014


================
Comment at: lib/CodeGen/CGAtomic.cpp:985
@@ +984,3 @@
+  // Okay, turn that back into the original value type.
+  if (auto *Result = atomics.tryConvertIntToValue(load))
+    return RValue::get(Result);
----------------
rjmccall wrote:
> ABataev wrote:
> > rjmccall wrote:
> > > Is there a good reason that this has to be conditional rather than just being a single convertIntToRValue method?  It's okay to pass a ReturnValueSlot in.
> > If some value cannot be bitcasted from Int to ValueType (from Int128 to fp80, for example), we have to create a temp. But we have to create different temps for AtomicLoad() and for AtomicCompareExchange() (here we must create a structure of 2 elements). And these temps must be created only if we were unable to directly cast from int to value type.
> Wait, what?  Why is EmitAtomicCompareExchange returning a first-class aggregate?  Just have it return a std::pair of values.  That will also let you return an RValue for the current value, which is probably more generally useful to its callers.
Ok, will do

http://reviews.llvm.org/D6499

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list