search for: argpromotion

Displaying 20 results from an estimated 103 matches for "argpromotion".

2010 Jun 18
1
[LLVMdev] argpromotion not working
Hi all, I have the following C code. static int addp(int *c, int a,int b) { int x = *c + a + b; return(x); } I want to replace *c with a scalar. So I tried the -argpromotion pass. However, it fails to do anything to the resulting llvm file. List of commands: clang add.c -c -o add.bc clang add.c -S -o add.ll opt -argpromotion -stats add.bc -o add_a.bc llvm-dis < add_a.bc > add_a.ll Also, when I try to print the stats I get a message "Maximum CGSCCPassMgr i...
2008 Jul 10
0
[LLVMdev] Argpromotion improvements (and fix for PR 2498)
...for all loads. In this way, only loads that are really safe will be promoted. If there are any non-safe loads left, nothing will be promoted at all. The attached patch also includes a testcase. It passes the both the DejaGNU tests and the test suite. Fixing this required some restructuring of the Argpromotion pass. In particular, indices are no longer tracked as Value*, but as unsigned, since that resolves the differences in integer constants of different type (since GEP allows both i64 and i32). Also, the way IsSafeToPromoteArgument works is rather different now. Because of these changes, I would like...
2017 Oct 27
6
RFC: We need to explicitly state that some functions are reserved by LLVM
...align 8 store { i8* }* %arg, { i8* }** %tmp, align 8 br i1 undef, label %bb4, label %bb1 bb1: %tmp2 = load { i8* }*, { i8* }** %tmp, align 8 %tmp3 = call i8* @access({ i8* }* %tmp2, i64 undef) br label %bb4 bb4: ret i8* undef } This IR, if compiled with `opt -passes='cgscc(inline,argpromotion)' -disable-output` hits a bunch of asserts in the LazyCallGraph. The problem here is that `argpromotion` turns a normal looking function `i8* @access({ i8* }* %arg, i64)` and turn it into a magical function `i8* @access(i8* %arg, i64)`. This latter signature is the POSIX `access` function that...
2020 Jan 07
2
Let CallGraphSCCPass Use Function-Level Analysis
Dear all, I would like to use the PostDominatorTree in ArgPromotion. I did not find an example of how to use function level analysis inside CallGraphSCCPass. I tried to follow an example of how to use function-level pass in a module pass, but I hit "llvm_unreachable" in PMDataManager::addLowerLevelRequiredPass. What would be a proper way to make PostDomi...
2014 Jan 24
2
[LLVMdev] byval attr for base+range parameters
...an_transfer_integer_write(%struct.__st_parameter_dt*, i8*, i32) (This is the fortran runtime api to 'printf' one integer) The 2nd & 3rd args are used to specify the memory of that integer. I didn't find a comfortable way to specify that it's 'byval'. I need this to make argpromotion work. Right now I just create an alloca, load value into it, and specify this alloca(base+range) as parameter. Is it a missing feature or there is a solution already? thanks, yuanfang
2017 Oct 27
5
RFC: We need to explicitly state that some functions are reserved by LLVM
...> bb1: > > %tmp2 = load { i8* }*, { i8* }** %tmp, align 8 > > %tmp3 = call i8* @access({ i8* }* %tmp2, i64 undef) > > br label %bb4 > > > > bb4: > > ret i8* undef > > } > > > > This IR, if compiled with `opt -passes='cgscc(inline,argpromotion)' > -disable-output` hits a bunch of asserts in the LazyCallGraph. > > > > The problem here is that `argpromotion` turns a normal looking function > `i8* @access({ i8* }* %arg, i64)` and turn it into a magical function `i8* > @access(i8* %arg, i64)`. This latter signature i...
2008 Jul 16
3
[LLVMdev] GEP::getIndexValid() with other iterators
Hi all, currently, GetElementPtrInst has a method getIndexedType, which has a templated variant. You pass in a begin and an end iterator, and it will find the indexed type for those. However, both iterators must iterate over Value*. For some argpromotion code, I would like to pass in iterators that iterate over unsigneds instead of Value*. I currently solve this by transforming my vector<unsigned> into a vector<Value*>, but this is hardly an efficient solution. Currently, however, there is already a templated version of getIndexedType,...
2009 Jan 25
0
[LLVMdev] -O4 limitations in llvm/llvm-gcc-4.2 2.5?
...d there appears to be > no regressions in the resulting code. I take it that LTO > in llvm 2.5 is still limited to dead code elimination, > correct? No. libLTO does the equivalent to opt -internalize -ipsccp -globalopt -constmerge -deadargelim -instcombine -inline -prune-eh -globaldce -argpromotion -instcombine -jump-threading -scalarrepl -globalsmodref-aa -licm -gvn -memcpyopt -dse -instcombine -jump-threading -mem2reg -simplifycfg -globaldce Will LTO ever be extended to inlining across > files as well as constant-folding and global data > allocation optimizations? Our optimizati...
2008 Apr 18
1
[LLVMdev] PATCH allow for promoting any size struct arguments
...y multiple individual arguments. The default pass only does this when the aggregrate has 3 or less elements, otherwise the code will be unchanged. I have a need to always promote aggregrate arguments, even when there are a lot of them. The attached patch adds a "maxElements" argument to ArgPromotion's constructor and to createArgumentPromotionPass with a default value of 3 to preserve the original behaviour. Please review and commit this patch. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: argpromotion-max.diff Type: text/x-diff Size: 4...
2008 Jun 07
0
[LLVMdev] Plans considering first class structs and multiple return values
...lex) Why would you ever want to pass multiple values as an aggregate to a call? The only thing I can think of is for ABI reasons. If you can do an ABI changing transformation (such as you propose) the first thing I'd do is expand the aggregate to pass as a series of scalars. Having argpromotion do this would be very natural. > However, the only way to really do this is to make all functions > return a > struct, possibly of only a single element. This also requires a > guarantee that > nothing special happens to the return value as a whole, but only the > individual...
2010 Jun 04
3
[LLVMdev] Is there a "callback optimization"?
...Changed to use non-virtual versions created above. void foo() { useMyCallback(); useMyOtherCallback(); } With that transform in place, lots of inlining becomes possible, and direct function calls replace indirect function calls if inlining isn't appropriate. If this transform is combined with argpromotion and scalarrepl, it can be used for devirtualization of C++ virtual function calls. There seems to be an awful lot of C++ code out there that uses templates to perform this same optimization in source code.
2009 Jan 25
2
[LLVMdev] -O4 limitations in llvm/llvm-gcc-4.2 2.5?
I've had better luck compiling all of pymol 1.1r2 with -O4 on darwin9. Everythink links and there appears to be no regressions in the resulting code. I take it that LTO in llvm 2.5 is still limited to dead code elimination, correct? Will LTO ever be extended to inlining across files as well as constant-folding and global data allocation optimizations? Or does the reliance on gcc-4.2 as the
2020 Jan 07
2
Let CallGraphSCCPass Use Function-Level Analysis
...liar with it now. Anyway, hope this helps! > > - Brian Gesiak > > On Tue, Jan 7, 2020 at 8:13 AM Mikhail Gudim via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Dear all, > > > > > > > > I would like to use the PostDominatorTree in ArgPromotion. I did not find an example of how to use function level analysis inside CallGraphSCCPass. I tried to follow an example of how to use function-level pass in a module pass, but I hit “llvm_unreachable” in PMDataManager::addLowerLevelRequiredPass. > > > > > > > > What would be...
2012 Mar 06
2
[LLVMdev] Assembly Mips from bitecode llvm
...t-llvm basicmath_small.c -c -o basicmath_small.bc llvm-gcc -emit-llvm cubic.c -c -o cubic.bc llvm-gcc -emit-llvm isqrt.c -c -o isqrt.bc llvm-gcc -emit-llvm rad2deg.c -c -o rad2deg.bc llvm-link basicmath_small.bc cubic.bc isqrt.bc rad2deg.bc -o basicmath.bc otms="disable-opt#adce#always-inline#argpromotion#block-placement#....." IFS=# for i in $otms do printf "\n$i ::::::: " opt -$i basicmath.bc -o basicmath.$i.bc llc -march=mipsel basicmath.$i.bc -o basicmath.$i.s done On Tue, Mar 6, 2012 at 10:11 AM, Anton Korobeynikov <anton at korobeynikov.info > wrote: > Hello &gt...
2008 Jun 02
2
[LLVMdev] Plans considering first class structs and multiple return values
...that just promotes > first-class aggregate arguments to a bunch of individual > non-aggregate arguments. Promoting struct arguments to multiple seperate values is exactly what I said that needed happening (but since I'm currently using byval struct* arguments, which are already handled by argpromotion) I'm probably not going to change this. However, that will not help for return values, as the passes I mentioned (IPConstProp and DeadArgElim) do not look at individual return values currently, only the returned struct as a whole. I do not intend to modify the argument propagation/elimination...
2010 Oct 11
0
[LLVMdev] Missed devirtualization opportunities
...fined results, eliminated the loads of the vtbl > pointer and replaced them with @classvtbl.TestVirtual. This would > allow devirtualization within a function at least, but (I think) would > do less to allow analysis to spot devirtualization opportunities > across functions. (Although ArgPromotion could arrange to have the > vtbl pointer passed in separately, and then inlining and/or partial > specialization could be made to see that it's a pointer to a constant > and thus add in the IndirectCallBonus) There are always going to be cases that can only be deduced with language kn...
2011 Dec 30
1
[LLVMdev] Safe Passes
Which transformation passes are 'safe', meaning it does not worsens the effectiveness of a later pass or the generated code? I imagine all passes which either removes data or add attributes are included in this list, plus some simplification passes: -adce -argpromotion -constmerge -constprop -deadargelim -dse -functionattrs -globaldce -globalopt -gvn -instcombine -internalize -ipconstprop -ipsccp -licm -prune-eh -sccp Also, is there any redundant pass in this list (things line sccp/ipsccp)?
2010 Jun 04
0
[LLVMdev] Is there a "callback optimization"?
...neth, > By that I mean an optimization pass (or a combination of them) that turns: ... > With that transform in place, lots of inlining becomes possible, and > direct function calls replace indirect function calls if inlining > isn't appropriate. If this transform is combined with argpromotion > and scalarrepl, it can be used for devirtualization of C++ virtual > function calls. > > There seems to be an awful lot of C++ code out there that uses > templates to perform this same optimization in source code. yes, LLVM does this. For example, running your example through the...
2010 Oct 11
4
[LLVMdev] Missed devirtualization opportunities
...tbl pointer has undefined results, eliminated the loads of the vtbl pointer and replaced them with @classvtbl.TestVirtual. This would allow devirtualization within a function at least, but (I think) would do less to allow analysis to spot devirtualization opportunities across functions. (Although ArgPromotion could arrange to have the vtbl pointer passed in separately, and then inlining and/or partial specialization could be made to see that it's a pointer to a constant and thus add in the IndirectCallBonus) At this point I'm looking for suggestions and feedback. I think implementing (1) and (...
2007 Jun 19
1
[LLVMdev] Question about adding a pass in LLVM
...ument 'disable-output' defined more than once! opt: CommandLine Error: Argument 'p' defined more than once! opt: CommandLine Error: Argument 'f' defined more than once! opt: CommandLine Error: Argument 'o' defined more than once! opt: CommandLine Error: Argument 'argpromotion' defined more than once! ..... (it just repeated outputting the last line, without stop...) Has anybody met the similiar problem with me? Thanks :) -- Yours, Fiona -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/at...