search for: globalopt

Displaying 20 results from an estimated 202 matches for "globalopt".

2014 Apr 30
4
[LLVMdev] Best way to clean up empty global_ctors
Hi, I'd like to fix PR19590, which is about llvm.global_ctors containing functions that end up being empty after optimization (which causes the linker to add useless init_array entries to the output binary). globalopt removes empty functions from llvm.global_ctors, but by the time the function becomes empty globalopt has already run and it doesn't run again. I'm wondering what the best fix is: 1. Should globalopt run once more after all other passes have run? 2. Or should the llvm.global_ctors optimizat...
2012 Aug 29
0
[LLVMdev] How to require ScalarEvolution analysis in a Module pass?
...what should I do to require ScalarEvolution analysis in a Module pass??? Steps to reproduce(bc file attached in case you do not have clang installed): 1. Makefile looks like this: all: clang test.c -disable-llvm-optzns -emit-llvm -S llvm-as test.s -o test.bc opt test.bc -loop-unroll -globalopt -loop-unroll -inline -loop-idiom -o out.bc llvm-dis < out.bc > out.ll 2. test.c: #include <stdio.h> int A[100]; static int toBeInlined(int A[100]) { int ans = 0; for (int i=0; i<100; ++i) ans+=A[i]; return ans; } int main() { for (int i=0; i<100; ++i)...
2013 Apr 29
3
[LLVMdev] Many tests fail on Win64
Hi, I check-out the latest version of LLVM and see many failures (on Win64): ******************** 67> FAIL: LLVM :: Transforms/GlobalOpt/zeroinitializer-gep-load.ll (5518 of 7763) 67> ******************** TEST 'LLVM :: Transforms/GlobalOpt/zeroinitializer-gep-load.ll' FAILED ******************** 67> Script: 67> -- 67> W:/LLVM_org/build64/bin/Debug/opt.EXE < W:\LLVM_org\llvm\test\Transforms\GlobalOpt\zeroin...
2014 May 01
3
[LLVMdev] Best way to clean up empty global_ctors
I talked about this with Nick in person months ago, and my understanding is that GlobalOpt is also an enabling optimization that needs to run early. For example, if we can eliminate an initializer to an internal global with no other stores to it, we can propagate the result. Maybe we should run it twice. On Thu, May 1, 2014 at 11:01 AM, Rafael Espíndola < rafael.espindola at gmail...
2015 Sep 18
2
GlobalOPT and sections
Hello everyone, This is a rather ancient code with Chris's name all over it, so I naturally feel humbled :) I see a conceptual issue in lib/Transforms/IPO/GlobalOpt.cpp with several optimizations that create a copy of GlobalVariable without copying attributes from the original one. Consider this one: http://llvm.org/doxygen/GlobalOpt_8cpp_source.html static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { ... // Create the new glo...
2015 Sep 21
2
GlobalOPT and sections
...nter, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation > -----Original Message----- > From: Chris Lattner [mailto:clattner at apple.com] > Sent: Sunday, September 20, 2015 5:28 PM > To: Sergei Larin > Cc: llvm-dev at lists.llvm.org; Lang Hames > Subject: Re: GlobalOPT and sections > > On Sep 18, 2015, at 10:45 AM, Sergei Larin <slarin at codeaurora.org> wrote: > > What I do not see - the section information from the original GV is never > copied to the NewGV, so this test would be failing for me: > > Now the proverbial question - is t...
2015 Nov 05
4
[PATCH] D14227: Add a new attribute: norecurse
...ible to demote global variables to local variables. This is possible when the global is only used in one function, and that function is known not to recurse (because if the function recurses, a local variable cannot be equivalent to a global as the global would hold state over the recursive call). GlobalOpt has this ability already, however it is currently (a) weak and (b) broken. GlobalOpt has a special case for the function "main". It assumes that any function called "main" with external linkage is by definition non-recursive. It does this because in C++, main is defined by the...
2013 Apr 29
0
[LLVMdev] Many tests fail on Win64
...even on 64-bit Windows. On Mon, Apr 29, 2013 at 4:27 AM, Demikhovsky, Elena <elena.demikhovsky at intel.com> wrote: > Hi, > > > > I check-out the latest version of LLVM and see many failures (on Win64): > > ******************** > > 67> FAIL: LLVM :: Transforms/GlobalOpt/zeroinitializer-gep-load.ll (5518 of > 7763) > > 67> ******************** TEST 'LLVM :: > Transforms/GlobalOpt/zeroinitializer-gep-load.ll' FAILED > ******************** > > 67> Script: > > 67> -- > > 67> W:/LLVM_org/build64/bin/Debug/opt.EXE...
2012 Aug 31
0
[LLVMdev] Function inline pass core dump when removing a function
Guys, In this case, I wanted to hack globalopt pass to require ScalarEvolution analysis. It seems ScalarEvolution is not released after globalopt pass, and it will hold a reference to the basicblocks. Later when the function is removed(by inline pass), coredump happened: opt test.bc -mem2reg -globalopt -inline -loop-unroll -debug-pass Details -...
2008 May 14
2
[LLVMdev] malloc, magic, and embedded compilation
...ris Lattner wrote: > On Wed, 14 May 2008, Jonathan S. Shapiro wrote: > > On Wed, 2008-05-14 at 16:15 +0200, Duncan Sands wrote: > >> I don't think the logic is based on "main", but on whether functions > >> are marked "internal" or not. That said, GlobalOpt.cpp seems to reason > >> based on the name "main" (most likely bogus, because of constructors/ > >> destructors running before main). > > > > Umm. That sounds like a test case that really wants to get written. > > huh? Duncan asserted that there is a...
2015 Nov 05
2
[PATCH] D14227: Add a new attribute: norecurse
...is is possible when the global is only used in one function, and that > > function is known not to recurse (because if the function recurses, a > local > > variable cannot be equivalent to a global as the global would hold state > > over the recursive call). > > > > GlobalOpt has this ability already, however it is currently (a) weak and > (b) > > broken. > > > > GlobalOpt has a special case for the function "main". It assumes that any > > function called "main" with external linkage is by definition > non-recursive. &gt...
2013 Apr 29
1
[LLVMdev] Many tests fail on Win64
...even on 64-bit Windows. On Mon, Apr 29, 2013 at 4:27 AM, Demikhovsky, Elena <elena.demikhovsky at intel.com> wrote: > Hi, > > > > I check-out the latest version of LLVM and see many failures (on Win64): > > ******************** > > 67> FAIL: LLVM :: Transforms/GlobalOpt/zeroinitializer-gep-load.ll (5518 of > 7763) > > 67> ******************** TEST 'LLVM :: > Transforms/GlobalOpt/zeroinitializer-gep-load.ll' FAILED > ******************** > > 67> Script: > > 67> -- > > 67> W:/LLVM_org/build64/bin/Debug/opt.EXE...
2016 May 10
2
Some questions about phase ordering in OPT and LLC
> >> You can look at AddOptimizationPasses() in opt.cpp. > > > > As far as I understand, the two passmanager do not interleave their > > passes. It first runs all the function passes and below. Then all the > > module passes. So if you specify: > > > > opt -mymodulepass0 -myfunctionpass -mymodulepass1 > > > > What you actually get is:
2016 Mar 22
1
Question about GlobalOpt
...ple.com] Sent: Monday, March 21, 2016 4:02 PM To: Sanjin Sijaric <ssijaric at codeaurora.org> Cc: LLVM Dev Mailing List <llvm-dev at lists.llvm.org>; Chandler Carruth <chandlerc at google.com>; James Molloy <james at jamesmolloy.co.uk> Subject: Re: [llvm-dev] Question about GlobalOpt On Mar 21, 2016, at 3:57 PM, Sanjin Sijaric via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote: Hi, GlobalOpt may not consider demoting globals to locals in the “main” function when C is used. It used to consider “main” speci...
2016 Aug 30
4
TryToShrinkGlobalToBoolean in GlobalOpt.cpp issue
Given some code: static int x = 100; int main() { x = 101; printf("%d\n", x); } results in: %0 = load i1 %1 = select %0, 101, 100 ... ... 1) What architecture(s) does this benefit? 2) What's the best way to circumvent this in the backend (currently I am just not allowing this opt function to run)? I have tried a few setOperationAction methods to no result. Rather not just
2008 May 14
0
[LLVMdev] malloc, magic, and embedded compilation
On Wed, 14 May 2008, Jonathan S. Shapiro wrote: >> huh? > > Duncan asserted that there is a behavior in GlobalOpt.cpp that relies on > main being the single entry point. If he is mistaken, great. If he is > correct, a regression test case for this seems like a useful thing to > build. I'm not saying that somebody else should do it. In fact, it seems > like a fine way to start getting my hands d...
2013 Apr 29
0
[LLVMdev] Many tests fail on Win64
...4:27 AM, Demikhovsky, Elena > <elena.demikhovsky at intel.com> wrote: > > Hi, > > > > > > > > I check-out the latest version of LLVM and see many failures (on Win64): > > > > ******************** > > > > 67> FAIL: LLVM :: Transforms/GlobalOpt/zeroinitializer-gep-load.ll (5518 > of > > 7763) > > > > 67> ******************** TEST 'LLVM :: > > Transforms/GlobalOpt/zeroinitializer-gep-load.ll' FAILED > > ******************** > > > > 67> Script: > > > > 67> -- >...
2015 Nov 05
2
[PATCH] D14227: Add a new attribute: norecurse
...that > >> > function is known not to recurse (because if the function recurses, a > >> > local > >> > variable cannot be equivalent to a global as the global would hold > state > >> > over the recursive call). > >> > > >> > GlobalOpt has this ability already, however it is currently (a) weak > and > >> > (b) > >> > broken. > >> > > >> > GlobalOpt has a special case for the function "main". It assumes that > >> > any > >> > function called &quot...
2016 Mar 21
3
Question about GlobalOpt
Hi, GlobalOpt may not consider demoting globals to locals in the "main" function when C is used. It used to consider "main" specifically prior to commit r253168 , for both C and C++. Since r253168, the check for the norecurse attribute may prevent "main" from being considered. T...
2013 Jul 08
1
[LLVMdev] Special cased global-to-local-in-main replacement in GlobalOpt
Hello, GlobalOpt has an interesting special-case optimization for globals that are only accessed within "main". These globals are replaced by allocas within the "main" function (and the GV itself is deleted). The full condition for this happening is: // If this is a first class global and has...