[Lldb-commits] FW: [PATCH] Remove builtin attribute from calls whose targets we replace
Du Toit, Stefanus
stefanus.du.toit at intel.com
Tue Jul 23 14:27:41 PDT 2013
Forwarding to the list since Phabricator doesn't know about llvm-commits
yet (I've asked for it to be added).
Stefanus
--
Stefanus Du Toit <stefanus.du.toit at intel.com>
Intel Waterloo
On 2013-07-23 5:26 PM, "Stefanus Du Toit" <stefanus.du.toit at intel.com>
wrote:
>Hi dmalea,
>
>If we are replacing a function with the nobuiltin attribute, it may be
>called with the builtin attribute on call sites. Remove any such
>attributes since it's illegal to have a builtin call to something other
>than a nobuiltin function.
>
>This fixes the current buildbot breakage (LLDB crashes on "expression new
>foo(42)").
>
>http://llvm-reviews.chandlerc.com/D1203
>
>Files:
> source/Expression/IRForTarget.cpp
>
>Index: source/Expression/IRForTarget.cpp
>===================================================================
>--- source/Expression/IRForTarget.cpp
>+++ source/Expression/IRForTarget.cpp
>@@ -356,6 +356,20 @@
>
> if (value_ptr)
> *value_ptr = value;
>+
>+ // If we are replacing a function with the nobuiltin attribute,
>it may
>+ // be called with the builtin attribute on call sites. Remove
>any such
>+ // attributes since it's illegal to have a builtin call to
>something
>+ // other than a nobuiltin function.
>+ if (fun->hasFnAttribute(Attribute::NoBuiltin)) {
>+ Attribute builtin = Attribute::get(fun->getContext(),
>Attribute::Builtin);
>+
>+ for (auto u = fun->use_begin(), e = fun->use_end(); u != e;
>++u) {
>+ if (auto call = dyn_cast<CallInst>(*u)) {
>+ call->removeAttribute(AttributeSet::FunctionIndex,
>builtin);
>+ }
>+ }
>+ }
>
> fun->replaceAllUsesWith(value);
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1203.1.patch
Type: text/x-patch
Size: 1023 bytes
Desc: D1203.1.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130723/4283a755/attachment.bin>
More information about the lldb-commits
mailing list