similar to: [LLVMdev] Replace constant with variable

Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] Replace constant with variable"

2012 Jun 18
0
[LLVMdev] Replace constant with variable
Hi Jonas, > I wondered if there was a standard way in LLVM to replace a constant > with a variable. The standard replaceAllUsesWith does not work because > other constants may use the constant-to-be-replaced. I would like to > recursively replace these by the corresponding expression. why? Ciao, Duncan.
2013 Jan 08
0
[LLVMdev] get ref to parent instruction
On Tue, Jan 8, 2013 at 3:06 PM, Eduardo <erocha.ssa at gmail.com> wrote: > Hi all, > > How can I get a reference to an instruction if I have a reference to > an operand? For example, let suppose I have a reference to the > ConstantExpr "getelementptr inbounds" in the following instruction: > > %4 = getelementptr i32* getelementptr inbounds ([8 x i32]* >
2017 Aug 17
2
Inst->replaceAllUsesWith and uses in ConstantExpr
Whoops, sorry, I meant "value->replaceAllUsesWith". Should I create a new post with an updated title? Thanks Siddharth On Thu 17 Aug, 2017, 01:05 Tim Northover <t.p.northover at gmail.com> wrote: > On 16 August 2017 at 15:39, (IIIT) Siddharth Bhat via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > From what I have observed, using
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
2017 Aug 16
2
Inst->replaceAllUsesWith and uses in ConstantExpr
Hello all, >From what I have observed, using `Inst->replaceAllUsesWith` does not replace uses of the `Inst` in `ConstantExpr`s. Is there some way to have a universal replaceAllUsesWith? Thanks, ~Siddharth. -- Sending this from my phone, please excuse any typos! -------------- next part -------------- An HTML attachment was scrubbed... URL:
2008 Jun 17
0
[LLVMdev] Transforming ConstantExprs to Instructions
On Tue, Jun 17, 2008 at 8:50 AM, Matthijs Kooijman <matthijs at stdin.nl> wrote: > 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
2019 Sep 19
2
Type unmatched after replacing functions
Hi all, I am trying to merge functions with the same debug location by using replaceAllUsesWith(). However, this leads to type unmatched problems because the functions with the same debug location can have different parameters. An example is foo(struct A) can be compiled to foo.1(struct A.1) and foo.2(struct A.2). I have inserted CastInst to solve the problems of arguments and return values type
2008 Dec 05
1
[LLVMdev] replacing a global variable by a constant
Thanks a lot for your help Matthijs! :) basically this does the job quite nicely I think: for (llvm::GlobalVariable::use_iterator U = gv->use_begin(); U != gv->use_end(); ++U) { llvm::Instruction *I = llvm::cast<llvm::Instruction>(U); I->replaceAllUsesWith(constPtr); I->eraseFromParent(); } Cheers, Ralf Matthijs Kooijman wrote: > Hi Ralf, > > >> I
2008 Dec 05
2
[LLVMdev] replacing a global variable by a constant
Hi, I am trying to replace a global variable with a constant. I did manage to do it, but somehow it appears to be fairly bruteforce by just iterating over all functions/bblocks/instructions and filtering for those that load the variable and replacing the instruction with Instruction::replaceAllUsesWith(). The more intuitive way of iterating over the uses of the variable did not work out as I
2013 Jan 08
4
[LLVMdev] get ref to parent instruction
Hi all, How can I get a reference to an instruction if I have a reference to an operand? For example, let suppose I have a reference to the ConstantExpr "getelementptr inbounds" in the following instruction: %4 = getelementptr i32* getelementptr inbounds ([8 x i32]* @__mem_grid_MOD_nnyp, i32 0, i32 0), i32 %3 then, how can I get a reference to the GetElementPtrInst object? The
2019 Jan 15
2
Function - replaceAllUsesWith
On Mon, Jan 14, 2019 at 3:21 AM Gaier, Bjoern via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hello LLVM-World, currently I play around with a „llvm::Module” and an external function defined there “puts”. Normally this function gets resolved in the JIT-Process but I wonder about two things: 1. Can I resolve the function already in this step? I
2016 Jan 22
2
Adding support for self-modifying branches to LLVM?
On Thu, Jan 21, 2016 at 2:52 PM, Jonas Wagner <jonas.wagner at epfl.ch> wrote: > Hello, > > There is some data on this, e.g, in “High System-Code Security with Low > Overhead” <http://dslab.epfl.ch/proj/asap/#publications>. In this work we > found that, for ASan as well as other instrumentation tools, most overhead > comes from the checks. Especially for
2012 Dec 28
1
[LLVMdev] Surprising SCEV / Constant folding result
Hello, I've tested LLVM's ScalarEvolution analysis with different small examples. Here's a result that surprised me: void dont_optimize_away(int); void foo(int n) { int res = 0; for (int i = 0; i < n; ++i) { // The kind of things that SCEV can recognize is quite astounding... // It wins over gcc for this one. //res = res + i*i; // Also, the kind of things it
2008 Dec 05
0
[LLVMdev] replacing a global variable by a constant
Hi Ralf, > I am trying to replace a global variable with a constant. You should be able to replace the initializer for the global with your constant, mark it as having internal linkage and then run some optimization pass over it to do the rest (not sure which one it was again, probably some constant propagation or global value optimization). That pass would then probably do some similar
2019 Jan 14
3
Function - replaceAllUsesWith
Hello LLVM-World, currently I play around with a "llvm::Module" and an external function defined there "puts". Normally this function gets resolved in the JIT-Process but I wonder about two things: 1. Can I resolve the function already in this step? I used "replaceAllUsesWith" and passed a "llvm::ConstantInt" to the function. But this didn't
2016 Feb 09
2
Adding support for self-modifying branches to LLVM?
Hi, I'm coming back to this old thread with data about the performance of NOPs. Recalling that I was considering transforming NOP instructions into branches and back, in order to dynamically enable code. One use case for this was enabling/disabling individual sanitizer checks (ASan, UBSan) on demand. I wrote a pass which takes an ASan-instrumented program, and replaces each ASan check with
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,
2012 Sep 29
2
[LLVMdev] [pocl-devel] [cfe-dev] SPIR provisional specification is now available in the Khronos website
On Sep 28, 2012, at 9:45 AM, James Molloy <james at jamesmolloy.co.uk> wrote: > You can easily simplify this problem with a restriction in SPIR: disallow ConstantExpr casts - no ptrtoint constant expression. Because GlobalVariables have pointer type, if you disallow converting their type to non-pointer type in a constantexpr, the number of constantexpr subclasses you have to deal with is
2013 Aug 02
1
[LLVMdev] replacing GetElementPtrConstantExpr with GetElementPtrInst ... sometimes
Hi During a pass, the XCore target lowers thread local global variables by turning them into global variable arrays indexed by the (max 8) thread ID. (see XCoreLowerThreadLocal.cpp) This works fine for instructions e.g. GetElementPtrInst But can't be done for constants e.g. GetElementPtrConstantExpr Thus I would like to replace GetElementPtrConstantExpr with GetElementPtrInst when it is
2011 Oct 21
2
[LLVMdev] Replacing uses within a function
Hi all, I am trying to replace all uses of a value1 *inside of a given function* to use value2. My strategy was to iterate all the basic blocks, again iterating all the instructions in each basic block, and using replaceUsesOfWith(value1, value2) for every instruction. This used to work all right, but now I am finding some problems. There are instructions like this: store i32 0, i32*