Displaying 20 results from an estimated 43 matches for "addfnattr".
2010 Nov 15
6
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
I'm using the gvn pass, not sure about basic-aa.
I've copied the code as-is from http://llvm.org/docs/tutorial/LangImpl4.html#code and added "F->addFnAttr( Attribute::ReadOnly )" after "Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule)".
The passes it sets up are:
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
OurFPM.add(new TargetDat...
2011 Jan 04
3
[LLVMdev] force inlineing a function using opt
Hi,
I am instrumenting the stores in a program by inserting a function
call (store_prologue) before every store instruction in the IR file. I
set the prologue function's attribute to "AlwaysInline" using
addFnAttr(). In the program the prologue function is defined as static
inline. I am using opt to generate an optimized (inline the calls to the
store prologue) using the following options "-always-inline". I also
tried "-inline". However, the calls to the prologue function are not
inl...
2012 Nov 05
2
[LLVMdev] Adding function attributes
...bject actually points to
copies of the functions?
Any help is much appreciated
Code
====
virtual bool runOnModule(Module& m)
{
Module* module = &m;
for (Module::iterator functionIter = module->begin(); functionIter !=
module->end(); functionIter++)
functionIter->addFnAttr(llvm::Attributes::AlwaysInline);
return true;
}
Command line
===========
clang -O0 -S -emit-llvm -o test.S test.c && opt -S -mem2reg -load <path to
lib> -mypass < test.S > test_opt.S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http:...
2010 Nov 15
1
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
SUCCESS!
Sorry, I had removed the addFnAttr() call by accident. Using the basicAA pass and ReadOnly, as you suggested, works like a charm!
:)
> -----Original Message-----
> From: Rob Pieke
> Sent: Monday, November 15, 2010 4:40 PM
> To: 'Duncan Sands'
> Cc: 'llvmdev at cs.uiuc.edu'; 'Dan Gohman'
>...
2018 Feb 02
2
Debug info error on bitcode inline modification
...CallInst::Create(callee, "", inst);
}
if (F->getName() == "callee")
{
F->setLinkage(GlobalValue::InternalLinkage);
F->addFnAttr(Attribute::AlwaysInline);
F->addFnAttr(Attribute::InlineHint);
}
}
}
std::error_code ec;
raw_fd_ostream os(argv[1], ec, sys::fs::F_None);
WriteBitcodeToFile(M, os);
}
------------------------...
2010 Nov 15
0
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
Hi Rob,
You need to set attribute ReadOnly on the sin / cos functions, using Function::addFnAttr(Attribute) for example.
Best regards,
--
Arnaud de Grandmaison
-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Rob Pieke
Sent: Monday, November 15, 2010 11:41 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Optimization of call...
2015 Jun 17
2
[LLVMdev] Inline hint for methods defined in-class
...CodeGenFunction::StartFunction(GlobalDecl GD,
if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) {
if (!CGM.getCodeGenOpts().NoInline) {
for (auto RI : FD->redecls())
- if (RI->isInlineSpecified()) {
+ if (RI->isInlined()) {
Fn->addFnAttr(llvm::Attribute::InlineHint);
break;
}
I tried this on C++ benchmarks in SPEC 2006. There is no noticeable
performance difference and the maximum text size increase is < 0.25%.
I then built clang with and without this change. This increases the
text size by 4.1%. For measur...
2011 Jan 05
0
[LLVMdev] force inlineing a function using opt
...llvmdev at cs.uiuc.edu
Subject: [LLVMdev] force inlineing a function using opt
Hi,
I am instrumenting the stores in a program by inserting a function
call (store_prologue) before every store instruction in the IR file. I
set the prologue function's attribute to "AlwaysInline" using
addFnAttr(). In the program the prologue function is defined as static
inline. I am using opt to generate an optimized (inline the calls to the
store prologue) using the following options "-always-inline". I also
tried "-inline". However, the calls to the prologue function are not
inlined...
2012 Nov 05
2
[LLVMdev] Adding function attributes
...gt;> Code
>> ====
>> virtual bool runOnModule(Module& m)
>> {
>> Module* module = &m;
>>
>> for (Module::iterator functionIter = module->begin(); functionIter !=
>> module->end(); functionIter++)
>> functionIter->addFnAttr(llvm::**Attributes::AlwaysInline);
>>
>> return true;
>> }
>>
>>
>> Command line
>> ===========
>> clang -O0 -S -emit-llvm -o test.S test.c && opt -S -mem2reg -load <path
>> to lib>
>> -mypass < test.S > test_opt.S...
2010 Nov 15
2
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
In http://llvm.org/docs/tutorial/LangImpl4.html#jit there's an example that optimizes calls to functions without side effects. Specifically,
ready> extern sin(x);
ready> extern cos(x);
ready> def foo(x) sin(x)*sin(x) + cos(x)*cos(x);
Read function definition:
define double @foo(double %x) {
entry:
%calltmp = call double @sin(double %x)
%multmp = fmul double %calltmp,
2018 Feb 02
0
Debug info error on bitcode inline modification
...CallInst::Create(callee, "", inst);
> }
>
> if (F->getName() == "callee")
> {
>
> F->setLinkage(GlobalValue::InternalLinkage);
> F->addFnAttr(Attribute::AlwaysInline);
> F->addFnAttr(Attribute::InlineHint);
> }
> }
> }
>
> std::error_code ec;
> raw_fd_ostream os(argv[1], ec, sys::fs::F_None);
> WriteBitcodeTo...
2013 Mar 13
0
[LLVMdev] attributes helper functions - please review
...de/llvm/IR/Function.h
===================================================================
--- include/llvm/IR/Function.h (revision 176874)
+++ include/llvm/IR/Function.h (working copy)
@@ -181,6 +181,14 @@
AttributeSet::FunctionIndex, N));
}
+ /// addFnAttr - Add function attributes to this function.
+ ///
+ void addFnAttr(StringRef Kind) {
+ setAttributes(
+ AttributeSets.addAttribute(getContext(),
+ AttributeSet::FunctionIndex, Kind));
+ }
+
/// \brief Return true if the function has the attribute.
bo...
2010 Nov 15
2
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
> You need to set attribute ReadOnly on the sin / cos functions, using
> Function::addFnAttr(Attribute) for example.
Hmm ... I tried setting that right after Function::Create but I still get the same result (though flagged with "readonly")
declare double @sin(double) readonly
declare double @cos(double) readonly
define double @foo(double %x) readonly {
entry:
%calltmp = cal...
2018 Feb 05
1
Debug info error on bitcode inline modification
...gt;> }
>>
>> if (F->getName() == "callee")
>> {
>> F->setLinkage(GlobalValue::
>> InternalLinkage);
>> F->addFnAttr(Attribute::AlwaysInline);
>> F->addFnAttr(Attribute::InlineHint);
>> }
>> }
>> }
>>
>> std::error_code ec;
>> raw_fd_ostream os(argv[1], ec, sys::fs::F_None);...
2019 Oct 01
2
Proposal for llvm.experimental.gc intrinsics for inttoptr and ptrtoint
...ences!
llvm.experimental.gc.ptrtoint:
dropgcroot_type = FunctionType::get(PtrIntTy,
makeArrayRef(PointerType::get(AddressSpace::Derived)), false);
dropgcroot_func = Function::Create(dropgcroot_type,
Function::ExternalLinkage, "julia.pointer_from_objref");
dropgcroot_func->addFnAttr(Attribute::ReadNone);
dropgcroot_func->addFnAttr(Attribute::NoUnwind);
declare void* @"julia.pointer_from_objref"(void addrspace(2)*) readnone
unwind
(AddressSpace::Derived in the signature means it doesn't need to be valid
as a root itself, but needs to be traced back to...
2015 Jun 17
2
[LLVMdev] Inline hint for methods defined in-class
...(GlobalDecl GD,
> if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) {
> if (!CGM.getCodeGenOpts().NoInline) {
> for (auto RI : FD->redecls())
> - if (RI->isInlineSpecified()) {
> + if (RI->isInlined()) {
> Fn->addFnAttr(llvm::Attribute::InlineHint);
> break;
> }
>
> I tried this on C++ benchmarks in SPEC 2006. There is no noticeable
> performance difference and the maximum text size increase is < 0.25%.
> I then built clang with and without this change. This increases the t...
2010 Nov 15
0
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
On Nov 15, 2010, at 8:42 AM, Rob Pieke wrote:
> SUCCESS!
>
> Sorry, I had removed the addFnAttr() call by accident. Using the basicAA pass and ReadOnly, as you suggested, works like a charm!
>
> :)
Thanks. I've updated the documentation and examples in r119169.
I didn't update the OCaml documentation or examples yet. It looks
like the OCaml bindings don't expose basicaa y...
2012 Nov 05
0
[LLVMdev] Adding function attributes
...help is much appreciated
>
>
> Code
> ====
> virtual bool runOnModule(Module& m)
> {
> Module* module = &m;
>
> for (Module::iterator functionIter = module->begin(); functionIter !=
> module->end(); functionIter++)
> functionIter->addFnAttr(llvm::Attributes::AlwaysInline);
>
> return true;
> }
>
>
> Command line
> ===========
> clang -O0 -S -emit-llvm -o test.S test.c && opt -S -mem2reg -load <path to lib>
> -mypass < test.S > test_opt.S
>
>
>
> __________________________...
2012 Nov 05
0
[LLVMdev] Adding function attributes
...===
> virtual bool runOnModule(Module& m)
> {
> Module* module = &m;
>
> for (Module::iterator functionIter = module->begin(); functionIter !=
> module->end(); functionIter++)
> functionIter->addFnAttr(llvm::__Attributes::AlwaysInline);
>
> return true;
> }
>
>
> Command line
> ===========
> clang -O0 -S -emit-llvm -o test.S test.c && opt -S -mem2reg -load <path
> to lib>
> -mypass < test....
2015 Jun 24
4
[LLVMdev] Inline hint for methods defined in-class
...l *FD = dyn_cast_or_null<FunctionDecl>(D)) {
> >> if (!CGM.getCodeGenOpts().NoInline) {
> >> for (auto RI : FD->redecls())
> >> - if (RI->isInlineSpecified()) {
> >> + if (RI->isInlined()) {
> >> Fn->addFnAttr(llvm::Attribute::InlineHint);
> >> break;
> >> }
> >>
> >> I tried this on C++ benchmarks in SPEC 2006. There is no noticeable
> >> performance difference and the maximum text size increase is < 0.25%.
> >> I then built cl...