summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp b/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp
index 792cc50..d68dc00 100644
--- a/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp
+++ b/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp
@@ -357,6 +357,20 @@ IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module)
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(llvm::Attribute::NoBuiltin)) {
+ llvm::Attribute builtin = llvm::Attribute::get(fun->getContext(), llvm::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);
}
OpenPOWER on IntegriCloud