[llvm] r266011 - Fix compile with GCC after r266002 (Add __atomic_* lowering to AtomicExpandPass)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 12 10:07:06 PDT 2016
On Mon, Apr 11, 2016 at 3:52 PM, James Y Knight via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: jyknight
> Date: Mon Apr 11 17:52:42 2016
> New Revision: 266011
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266011&view=rev
> Log:
> Fix compile with GCC after r266002 (Add __atomic_* lowering to
> AtomicExpandPass)
>
> It doesn't like implicitly calling the ArrayRef constructor with a
> returned array -- it appears to decays the returned value to a pointer,
> first, before trying to make an ArrayRef out of it.
>
> Modified:
> llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp?rev=266011&r1=266010&r2=266011&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp Mon Apr 11 17:52:42 2016
> @@ -1065,25 +1065,25 @@ static ArrayRef<RTLIB::Libcall> GetRMWLi
> case AtomicRMWInst::BAD_BINOP:
> llvm_unreachable("Should not have BAD_BINOP.");
> case AtomicRMWInst::Xchg:
> - return LibcallsXchg;
> + return ArrayRef<RTLIB::Libcall>(LibcallsXchg);
> case AtomicRMWInst::Add:
> - return LibcallsAdd;
> + return ArrayRef<RTLIB::Libcall>(LibcallsAdd);
> case AtomicRMWInst::Sub:
> - return LibcallsSub;
> + return ArrayRef<RTLIB::Libcall>(LibcallsSub);
> case AtomicRMWInst::And:
> - return LibcallsAnd;
> + return ArrayRef<RTLIB::Libcall>(LibcallsAnd);
> case AtomicRMWInst::Or:
> - return LibcallsOr;
> + return ArrayRef<RTLIB::Libcall>(LibcallsOr);
> case AtomicRMWInst::Xor:
> - return LibcallsXor;
> + return ArrayRef<RTLIB::Libcall>(LibcallsXor);
> case AtomicRMWInst::Nand:
> - return LibcallsNand;
> + return ArrayRef<RTLIB::Libcall>(LibcallsNand);
>
You could use "makeArrayRef" for all these so you don't have to specify the
return type everywhere.
> case AtomicRMWInst::Max:
> case AtomicRMWInst::Min:
> case AtomicRMWInst::UMax:
> case AtomicRMWInst::UMin:
> // No atomic libcalls are available for max/min/umax/umin.
> - return {};
> + return ArrayRef<RTLIB::Libcall>();
>
You can probably "return None" here if "return {}" isn't working (GCC
compatibility or something else)?
> }
> llvm_unreachable("Unexpected AtomicRMW operation.");
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/63b7b348/attachment.html>
More information about the llvm-commits
mailing list