search for: removedeadconstantus

Displaying 13 results from an estimated 13 matches for "removedeadconstantus".

2008 Jun 24
2
[LLVMdev] Removal of ConstantExprs
...o it gets whacked and its initializer gets set to NULL. This succesfully reduces the usecount of the bitcast to 0, but the bitcast itself does not get removed then. This means that further on, other transformations fail because A is still used by the bitcast. Now I know that there is GlobalValue::removeDeadConstantUsers which the transformation could be calling, but shouldn't that be arranged automatically? Also, in this case I'm using a bitcast of A, but what if this was a bitcast of a gep of a A? In this case, removeDeadConstantUsers on A would not remove anything, since the GEP is still used by the b...
2008 Jun 24
0
[LLVMdev] Removal of ConstantExprs
...s initializer gets set to NULL. This > succesfully reduces the usecount of the bitcast to 0, but the bitcast itself > does not get removed then. This means that further on, other transformations > fail because A is still used by the bitcast. ok. > Now I know that there is GlobalValue::removeDeadConstantUsers which the > transformation could be calling, but shouldn't that be arranged automatically? We can't "garbage collect" ConstantExprs at arbitrary points: they may exist in maps, in local variables etc. There is no good way to know they are dead. > Also, in this case I...
2008 Jun 24
1
[LLVMdev] Removal of ConstantExprs
...lect" ConstantExprs at arbitrary points: they may > exist in maps, in local variables etc. There is no good way to know they > are dead. Ah, makes sense. > > Also, in this case I'm using a bitcast of A, but what if this was a bitcast of > > a gep of a A? In this case, removeDeadConstantUsers on A would not remove > > anything, since the GEP is still used by the bitcast. > removeDeadConstantUsers removes both of them. Existing clients call > removeDeadConstantUsers and then recheck to see if the use count is zero. > If not, there was some real user that can't be...
2015 Jun 04
5
[LLVMdev] Removing AvailableExternal values in GlobalDCE (was Re: RFC: ThinLTO Impementation Plan)
On Thu, Jun 4, 2015 at 3:58 PM, Duncan P. N. Exon Smith < dexonsmith at apple.com> wrote: > > > Personally, I think the right approach is to add a bool to > createGlobalDCEPass defaulting to true named something like > IsAfterInlining. In most standard pass pipelines, GlobalDCE runs after > inlining for obvious reasons, so the default makes sense. The special case > is
2015 Jun 08
2
[LLVMdev] Removing AvailableExternal values in GlobalDCE (was Re: RFC: ThinLTO Impementation Plan)
...I != E; ++I) { + if (!I->hasAvailableExternallyLinkage()) + continue; + if (I->hasInitializer()) { + Constant *Init = I->getInitializer(); + I->setInitializer(nullptr); + if (isSafeToDestroyConstant(Init)) + Init->destroyConstant(); + } + I->removeDeadConstantUsers(); + NumVariables++; + } + + // Drop the bodies of available externally functions. + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { + if (!I->hasAvailableExternallyLinkage()) + continue; + if (!I->isDeclaration()) + I->deleteBody(); + I->rem...
2015 Jun 05
2
[LLVMdev] Removing AvailableExternal values in GlobalDCE (was Re: RFC: ThinLTO Impementation Plan)
On Thu, Jun 4, 2015 at 5:33 PM, Reid Kleckner <rnk at google.com> wrote: > On Thu, Jun 4, 2015 at 5:17 PM, Teresa Johnson <tejohnson at google.com> wrote: >> >> Agreed. Although I assume you mean invoke the new pass under a >> ThinLTO-only option so that avail extern are not dropped in the >> compile pass before the LTO link? > > > No, this pass
2011 Sep 23
2
[LLVMdev] constantexpr problem
Hi all, I have got a problem when I used the use_empty() member function while I used a global variable. I erase all the instructions which will use a global variable. Then I called the use_empty() on that global variable. I got no empty because a constantexpr use the global variable. I wonder whether there is any way to erase the constantexpr which is useless to me but occupying the global
2012 Aug 18
1
[LLVMdev] GlobalVariable initializer using from beyond the grave
For LLDB I'm writing a dumb module pass that removes all global variables, by running the following code: bool erased = true; while (erased) { erased = false; for (Module::global_iterator gi = llvm_module.global_begin(), ge = llvm_module.global_end(); gi != ge; ++gi) { GlobalVariable *global_var =
2012 Aug 29
0
[LLVMdev] How to require ScalarEvolution analysis in a Module pass?
...ENDENCY(ScalarEvolution) INITIALIZE_PASS_END(GlobalOpt, "globalopt", "Global Variable Optimizer", false, false) @@ -2087,6 +2090,7 @@ if (!F->hasName() && !F->isDeclaration()) F->setLinkage(GlobalValue::InternalLinkage); F->removeDeadConstantUsers(); + ScalarEvolution *SE = &getAnalysis<ScalarEvolution>(*F); ------------------------------------> CRASH here: if (F->isDefTriviallyDead()) { F->eraseFromParent(); Changed = true; 4. core dump #0 0x000000386de30265 in raise () from /lib64/libc.so.6 #1...
2011 Oct 26
0
[LLVMdev] Use still stuck around after Def is destroyed:
On Oct 26, 2011, at 12:18 PM, ret val wrote: > I made a GlobalVariable that is of type ConstantArray. For one of it's > elements I assigned it the ConstantExpr::getBitCast of another > GlobalVariable(the "shadow pointer" mentioned). This gives me: > > While deleting: i32 (i32)** %Shadow Variable for ptr1 > Use still stuck around after Def is
2012 Aug 31
0
[LLVMdev] Function inline pass core dump when removing a function
...nstruction *I = &*i; + if (I->getType()->isIntegerTy() || I->getType()->isPointerTy()) + const SCEV* SS = SE->getSCEV(I); + } + } if (!F->hasName() && !F->isDeclaration()) F->setLinkage(GlobalValue::InternalLinkage); F->removeDeadConstantUsers(); 4. The coredump: (gdb) bt #0 0x000000386de30265 in raise () from /lib64/libc.so.6 #1 0x000000386de31d10 in abort () from /lib64/libc.so.6 #2 0x0000000000aa93e6 in llvm::llvm_unreachable_internal ( msg=0xcce748 "An asserting value handle still pointed to this value!", fil...
2011 Oct 26
3
[LLVMdev] Use still stuck around after Def is destroyed:
I made a GlobalVariable that is of type ConstantArray. For one of it's elements I assigned it the ConstantExpr::getBitCast of another GlobalVariable(the "shadow pointer" mentioned). This gives me: While deleting: i32 (i32)** %Shadow Variable for ptr1 Use still stuck around after Def is destroyed:i8* bitcast (i32 (i32)** @"Shadow Variable for ptr1" to i8*)
2015 Jun 08
4
[LLVMdev] Removing AvailableExternal values in GlobalDCE (was Re: RFC: ThinLTO Impementation Plan)
...ableExternallyLinkage()) > + continue; > + if (I->hasInitializer()) { > + Constant *Init = I->getInitializer(); > + I->setInitializer(nullptr); > + if (isSafeToDestroyConstant(Init)) > + Init->destroyConstant(); > + } > + I->removeDeadConstantUsers(); > + NumVariables++; > + } > > Do you need to set the linkage of global variables to external? I noticed > that Function::deleteBody() does this but setInitializer(nullptr) does not. > Ditto for aliases. Hmm, I am not sure - I basically am doing the same things GlobalDCE...