similar to: [LLVMdev] Removal of ConstantExprs

Displaying 20 results from an estimated 10000 matches similar to: "[LLVMdev] Removal of ConstantExprs"

2008 Jun 24
0
[LLVMdev] Removal of ConstantExprs
On Tue, 24 Jun 2008, Matthijs Kooijman wrote: > I'm having a bit of trouble with ConstantExprs currently. In particular, a > global variable A is bitcasted and used in the initializer of another global > variable B (as a struct element). > > B is unused, so it gets whacked and its initializer gets set to NULL. This > succesfully reduces the usecount of the bitcast to 0, but
2008 Jun 24
1
[LLVMdev] Removal of ConstantExprs
> 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. 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,
2008 Jun 18
3
[LLVMdev] Transforming ConstantExprs to Instructions
Hi Chris, > > [ Snip replacing constantexprs with instructions ] > Ok, this is not possible in general though, global variable initializers > have to be constants, not instructions. Yeah, so if not all uses can be replaced, my pass will just have to skip the variable. > Is it possible to design the pass to work with both? The general approach > is to make stuff handle
2008 Jun 17
0
[LLVMdev] Transforming ConstantExprs to Instructions
On Tue, 17 Jun 2008, Matthijs Kooijman wrote: > I've been struggling with constantexprs for a bit. I'm working on a pass that > transforms global variables to local variables, and in particular the > GetElementPtrConstantExpr is a bit troublesome. For my transformation to > properly work, a global value should only be used by Instructions, not by > ConstantExprs. Ok, this
2008 Jun 17
4
[LLVMdev] Transforming ConstantExprs to Instructions
Hi, I've been struggling with constantexprs for a bit. I'm working on a pass that transforms global variables to local variables, and in particular the GetElementPtrConstantExpr is a bit troublesome. For my transformation to properly work, a global value should only be used by Instructions, not by ConstantExprs. I was thinking to add a ConstantExpr::replaceWithInstr() virtual method,
2009 Feb 28
3
[LLVMdev] Question about documentation of BitCast CExps.
In the documentation at [http://llvm.org/docs/LangRef.html], we have the section [#aggregateconstants] telling us that the aggregate constants are: * Structure constants * Array constants * Vector constants * Zeroinitialization However, in [#constantexprs] we have a bitcast(CST, TYPE) operator with the documentation (emphasis by me): Convert a constant, CST, to another TYPE. The size of
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*)
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
2008 Jun 19
0
[LLVMdev] Transforming ConstantExprs to Instructions
On Jun 18, 2008, at 1:36 AM, Matthijs Kooijman wrote: >> Is it possible to design the pass to work with both? The general >> approach >> is to make stuff handle "User"s instead of Instructions. It is >> much more >> compile time efficient to just handle the two forms rather than >> converting >> them back and forth. > With both I
2017 Aug 17
3
Inst->replaceAllUsesWith and uses in ConstantExpr
I see. Is there a pre-existing way to do this in LLVM? Cheers, ~Siddharth. On Thu, 17 Aug 2017 at 02:12 Craig Topper <craig.topper at gmail.com> wrote: > ConstantExprs are immutable, they can't be changed once they are created. > And a ConstantExpr can reference other ConstantExprs. So replacing all uses > of a Value in a ConstantExpr would require creating a new immutable
2008 Sep 22
0
[LLVMdev] Overzealous PromoteCastOfAllocation
On Sep 13, 2008, at 1:07 PM, Matthijs Kooijman wrote: > Hi Dan, > >> Changing PromoteCastOfAllocation to not replace aggregate allocas >> with >> non-aggregate allocas if they have GEP users sounds reasonable to me. > This sounds reasonable indeed, but still a bit arbitrary. Haven't > figured out > anything better yet, though. > >> Finding the
2008 Sep 13
3
[LLVMdev] Overzealous PromoteCastOfAllocation
Hi Dan, > Changing PromoteCastOfAllocation to not replace aggregate allocas with > non-aggregate allocas if they have GEP users sounds reasonable to me. This sounds reasonable indeed, but still a bit arbitrary. Haven't figured out anything better yet, though. > Finding the maximum alignment is sometimes still useful though, so > it would be nice to update the alignment field of
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 =
2009 Feb 28
0
[LLVMdev] Question about documentation of BitCast CExps.
Jesper Louis Andersen wrote: > In the documentation at [http://llvm.org/docs/LangRef.html], we have > the section [#aggregateconstants] telling us that the aggregate > constants are: > > * Structure constants > * Array constants > * Vector constants > * Zeroinitialization > > However, in [#constantexprs] we have a bitcast(CST, TYPE) operator > with the
2008 Apr 20
4
[LLVMdev] Global variable-length array
Question about "Pascal-style" arrays as mentioned in the reference guide. Suppose I have a global variable which points to a constant, variable length array. The question is, how can I assign an array of type "{ i32, [5 x float]}" to a global of type "{ i32, [0 x float]}"? From my experimentation, it appears you can't bitcast or call GEP on a constant
2012 Dec 18
2
[LLVMdev] target specific ways to extend ConstantExpr
The particular case we are looking at is converting a pointer from one address space to another address space. There is one operand and one output, both are the same pointer type, except for their address space. The pointers are of the same size. The operation is a bit-changing operation. We are using intrinsic functions for the instructions. We need a solution for the ConstantExpr. Instead of
2004 Jun 17
0
[LLVMdev] generating instructions with embedded ConstantExprs from within LLVM
On Thu, 17 Jun 2004, Patrick Meredith wrote: > How is this done? Everything logical I have tried has failed, here was > one attempt: > > Constant *C = (Constant*) ConstantArray::get(inst2string(I)); //fucnction defined elsewhere > > //generates a correct Global string > GlobalVariable *str = new GlobalVariable(C->getType(), true, >
2013 Sep 28
1
[LLVMdev] use function address as global variable initializer
Hi I would like to initialize a global variable to the address of a function. Looking at how clang compiles the C code below, i see @main_ptr = global i8* bitcast (i32 ()* @main to i8*), align 8 but how do i generate i8* bitcast (i32 ()* @main to i8*), align 8 in LLVM IR and use it as initializer to a GlobalVariable. I know i will need to use the bitcast instruction. but as far i as i
2004 Jun 17
4
[LLVMdev] generating instructions with embedded ConstantExprs from within LLVM
How is this done? Everything logical I have tried has failed, here was one attempt: Constant *C = (Constant*) ConstantArray::get(inst2string(I)); //fucnction defined elsewhere //generates a correct Global string GlobalVariable *str = new GlobalVariable(C->getType(), true, GlobalValue::InternalLinkage, C, mkStrName( strNumber++ ), &M); std::vector<Value*>
2008 Sep 08
2
[LLVMdev] Overzealous PromoteCastOfAllocation
Hi all, I'm currently running into some problems with instcombine changing the type of alloca instructions. In particular, the PromoteCastOfAllocation looks at any allocation instruction that is used by a bitast. It does a few checks, but basically tries to change the type of the alloca instruction to the type pointed to by the bitcasted type. The current heuristic for determining if this is