New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move function attributes out of FunctionType into calls and functions #1518
Comments
Please don't move sext/zext out of FunctionType. They need to be part of the As for reducing size, I suggest we reserve bits in a Function for CC and Not sure about the call/invoke instructions. Can we just avoid putting them into |
I agree that they affect semantics, but why does that mean they need to be part of the type? Calling -Chris |
True, but in this case those parameter attributes go along with the arguments. As for making them part of the function type, it is necessary. When matching a |
I don't get it. I propose that the attributes are aggregated together for a function and uniqued. This
No, it isn't. :)
This conclusion makes little sense to me. Yes it is bad to mismatch the arguments and the attributes.
What issues? -Chris |
Unfortunately, I don't remember the details. I just remember starting out the I didn't mean to get into a debate about this, just to warn you about my |
I'm still not getting it. You're apparently talking about .ll file syntax, not where they are stored in memory, |
I'm talking about the code in llvmAsmParser.y and UpgradeParser.y that handles |
Moving function attributes out of FunctionType is orthogonal to the set |
Here's what I propose:
|
#1 agreed. Once the initial support is in place, we can talk about strategies for reducing memory use, etc. #2: you need them to support indirect function calls. If you do an indirect call to a function that takes an -Chris |
Okay, so to support indirect calls, we also need to have sext/zext/inreg It might be worth splitting the notions of parameter attribute from function Of more concern are the parameter attributes (sext/zext/inreg) which must be For the parameter attribute class, I suggest we do something like store a Thoughts? |
I think the goal should be to do a simple and straight-forward impl that splits them out from functiontype. -Chris |
Here's the increments I'll work on:
Step 1 is nearly done. Patch for review coming forth shortly. |
Step 1 is done. Step 2 is nearly done. We're going to reverse the order of steps 3 and 4 so that uniquing is done |
Step 2 is done. |
I don't see why it is a good idea to put attributes on all the calls and It doesn't seem practical be be adding attributes like zext, inreg, or How difficult is it to create a new function type to hold the new attributes, |
I assume you're objected because of the potential cost of this. In theory, the memory cost should not If we do this and find out that it is, we can reevaluate at that time.
Right.
Yes, in the future, I think there will be other (more) interesting ones as well, such as "nocapture" and
I'm not sure I understand. How would this work?
In the absense of indirect function calls, it is straight-forward but has cost linear with the number of With indirect function calls, it gets uglier, but still doable.
The issue here is due to how the LLVM type system works. An important property is that it guarantees Another fun design point of LLVM is that the type of a Value cannot be changed once it is created. The -Chris |
LangRef.html currently says "Parameter attributes are considered to be part of I think what I'm thinking of is something along the lines of |
Yep, langref will be updated.
Are you wondering how a specific transformation pass will be implemented? Consider pruneeh. It does Does this seem reasonable? -Chris |
It seems like either way could be implemented reasonably efficiently, so I guess |
When the attributes get placed into Function/Call, don't forget to un-XFAIL test/Assembler/2007-02-07-UpgradeCSRETCC.ll These were xfailed to avoid temporarily fixing llvm-upgrade to deal with some |
Uniquing and reference counting of ParamAttrsList objects is now done. |
It is unfortunate, but I wasn't able to get this working completely before the jit /External/SPEC/CFP2006/444.namd/444.namd |
FWIW, I committed these two patches to mainline, and hope they will be merged into llvm 2.0. This should allow us to implement this feature in llvm 2.1 without having to do unnatural gymnastics in -Chris http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049403.html |
This won't make it in 2.0 but hopefully will in 2.1 |
As there are several bugs depending on this one, I figure a status update is due: I have the changes necessary for this bug to be finished but they are untested. |
it will be a welcome fix, but there is no need to get it done before monday :) -Chris |
Hi Reid, in this part (include/llvm/Transforms/IPO.h):
I don't understand the comment. What is it trying to say? |
It is irrelevant to this PR, but the code in ExtractFunction.cpp says:
Reid. |
gcc part ported to svn head |
It mostly works but I am seeing some testsuite failures, especially problems
I tried changing it to:
but llvm-as says: 2007-11-25-CompatibleAttributes.ll:13,0: Unresolved global references exist: I guess that's because the @printf used in the bitcast refers to |
Reid, can you please have a look at the new llvm patch (no need to bother -ParamList : Types ValueRef OptParamAttrs { (I think ParamList used to be called ValuesList or something like that). LABEL ValueRef OptParamAttrs variant. I have no idea what those are, I just modified them analogously |
new llvm part |
new llvm part |
Sorry about the duplicates, it seems to be a bugzilla bug. The current status is that "make check" passes except for |
I ran the full testsuite with and without these patches, and there That said, with the patch there are many more lines like this: Also, the patches cause one "make check" failure: an auto-upgrade test The final bad point is that the gcc patch is rather grotty (I have some Nonetheless, I would like to apply the patches and sort out these PS: Part of another bit-fiddling patch got mixed in with the gcc |
There is one serious problem: it doesn't autoupgrade llvm 2.1 .ll files to the new format. In fact, the parser probably dies on stuff like this:
This is what llvm 2.1 produces from:
We need the parser to accept and ignore the signext in that case. |
Likewise, the bc reader also needs to upgrade old bc files. This looks really easy though, just remove this hunk:
changing it to just ignore the attrid field. The bcwriter would just always write 0 for it, and hardcode this in the FunctionAbbrev abbreviation. To do this, change the abbreviation definition from: Abbv = new BitCodeAbbrev();
to: ... With this change, there is no space penalty in the new .bc files, but the old files will be transparently read. |
Despite Reid's suggestion that the llvm-extract extensions are needed by the patch, I really can't see how that is. If possible, please remove them. |
with the asmparser fix, many of the testsuite changes won't be needed. Once these issues are addressed, the patch looks great to me, thanks Duncan! |
Fixed here (original patches by Reid Spencer, updated by yours truly): |
mentioned in issue llvm/llvm-bugzilla-archive#1383 |
mentioned in issue llvm/llvm-bugzilla-archive#1393 |
mentioned in issue llvm/llvm-bugzilla-archive#1394 |
mentioned in issue llvm/llvm-bugzilla-archive#1397 |
1 similar comment
mentioned in issue llvm/llvm-bugzilla-archive#1397 |
mentioned in issue llvm/llvm-bugzilla-archive#1443 |
mentioned in issue llvm/llvm-bugzilla-archive#1583 |
1 similar comment
mentioned in issue llvm/llvm-bugzilla-archive#1583 |
mentioned in issue llvm/llvm-bugzilla-archive#1612 |
mentioned in issue llvm/llvm-bugzilla-archive#1620 |
mentioned in issue llvm/llvm-bugzilla-archive#1716 |
Cherrypick upstream work
Extended Description
Function attributes are currently a property of the FunctionType. This makes it very painful to modify the
attributes of a function after the function is created (because the type is immutable). It would be much
better to put the attributes on the call/invoke instruction and on the Function object itself.
The trick to this is to find a memory-efficient way to represent this.
-Chris
The text was updated successfully, but these errors were encountered: