similar to: [LLVMdev] The use iterator not working...

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] The use iterator not working..."

2015 Jun 10
4
[LLVMdev] The use iterator not working...
Thanks Dan and Jon. I made an incorrect assumption that the "use" iterator was actually giving me the "user" when de-referencing it. Did it always have this behavior in previous LLVM versions? I've seen lots of examples of the "use" iterator being dereferenced and resulting Instruction pointer being treated as the "user"? Thanks, Zack On Tue, Jun 9,
2015 Jun 10
2
[LLVMdev] The use iterator not working...
It appears dereferencing the use iterator returned the "user" in older LLVM versions. See the following commit to Use.h. You can see that the intention is to return the "user". So this is not the behavior anymore. https://github.com/llvm-mirror/llvm/commit/d1fe495464e4abc384565813cbf1cb8b130e5a6d - // Retrieve a pointer to the current User.- UserTy *operator*() const {-
2013 Sep 24
2
[LLVMdev] get the address in memory where an instruction lives
Hi, i want to get the address in memory of an instruction pointer and use it as a key in my tables. i iterate over the instructions in LLVM IR like this: for (Module::iterator fi = Mod->begin(), fi_end = Mod->end(); fi != fi_end; ++fi) { for (inst_iterator I = inst_begin(fi), E = inst_end(fi); I != E; ++I) { Instruction *ii = dyn_cast<Instruction>(&*I);
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Chris Lattner wrote: > On Fri, 23 Apr 2004, Vladimir Prus wrote: > > and since result of *it is considered to be rvalue it can't be accepted > > by this operator. The complete discussion is in > > > > http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm > > > > I'd suggest to apply the following patch which makes operator* return >
2011 Aug 29
4
[LLVMdev] insertions with inst_iterators?
I am looping through all instructions in a Function and depending on what I found I may or may not insert code. Despite the fact that I'm only actually inserting *before* instruction I have a infinite loop when I do something like below. For awhile it was simple enough to just increment i enough times but now I need something better. for(inst_iterator i = inst_begin(F); i != inst_end(F); ++i)
2012 Feb 15
2
[LLVMdev] Wrong AliasAnalysis::getModRefInfo result
Just want to test out the LLVM's AliasAnalysis::getModRefInfo API. The input C code is very simple: void foo(int *a, int *b) { for(int i=0; i<10; i++) b[i] = a[i]*a[i]; } int main() { int a[10]; int b[10]; for(int i=0; i<10; i++) a[i] = i; foo(a,b); return 0; } Obviously, for "foo", it only reads from array "a" and only writes to array
2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
On Fri, 23 Apr 2004, Vladimir Prus wrote: > Yea, I've noticed that. However, it looks like inst_iterator is iterator over > pointers. Oh, wait a minite, that's the current code: > > inline IIty operator*() const { return BI; } > inline IIty operator->() const { return operator*(); } > > So operator* works as if value_type is Instruction*, but operator->
2013 Aug 08
2
[LLVMdev] How to gather data dependences
Valmico <valmico88 at gmail.com> wrote: > I'm currently trying to develop new LLVM Pass that will generate > simple data dependencies graph. For now I'm trying to get familiar > with DependenceAnalysis. > My general idea is to traverse each function (runOnFunction) > top to bottom Instruction by Instruction, using DA.depends( I, I2, ...) > on every Instructions
2011 May 07
1
[LLVMdev] def-use chain for Instruction
Hello all, I am a LLVM newer who want to obtain the use-def chain for all instruction of a sample code, for this purpose i use the following code. ///////////////sample code:///////////////////////// #include <stdlib.h> #include <stdio.h> #include <time.h> #define ARRAY_SIZE 5 int main() { int x, y, holder; int k,z,f,i; z=0; f=0; k=0; for(x = 0; x < ARRAY_SIZE;
2011 Aug 29
0
[LLVMdev] insertions with inst_iterators?
On Aug 29, 2011, at 12:38 PM, ret val wrote: > I am looping through all instructions in a Function and depending on > what I found I may or may not insert code. Despite the fact that I'm > only actually inserting *before* instruction I have a infinite loop > when I do something like below. For awhile it was simple enough to > just increment i enough times but now I need
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code which is again very simple: ... bool runOnFunction(Function &F) override { vector<Instruction *> dels; dels.clear(); for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) { Instruction *I = &*(It++); if (auto* op = dyn_cast<BinaryOperator>(I)) { IRBuilder<NoFolder>
2018 Aug 08
3
Error Calling eraseFromParent()
LLVM is built in Release mode. The version is 6.0.0. I think that a similar code worked on verison 3.9.0. It is probably a null pointer dereference occurring in eraseFromParent(). I checked and reconfirmed that the instruction had no uses. Perhaps I should rebuild LLVM. Thanks. On Wed, Aug 8, 2018 at 9:03 PM, mayuyu.io <admin at mayuyu.io> wrote: > Hmmmm that’s strange. Do you get an
2011 Aug 23
2
[LLVMdev] write IR on file
hi how can i write IRinstruction on a file.txt? when i use  {for(inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I,count++)  IRcodefile << std::basic_ostream(*I) <<"\n" } i get  error. is there any way that i can write it on file? -------------- next part -------------- An HTML attachment was scrubbed... URL:
2013 Aug 09
0
[LLVMdev] How to gather data dependences
2013/8/8 Preston Briggs <preston.briggs at gmail.com> > > Hi, > > The DependenceAnalysis pass isn't reliable yet; it has several errors that > need to be corrected. These manifest by the analysis claiming there's no > dependence when one in fact exists. > > Your proposed scheme of testing every pair of instructions is > asymptotically expensive, requiring
2018 Aug 07
2
Error Calling eraseFromParent()
Thanks Bjorn! But The problem is still there. On Wed, Aug 8, 2018 at 2:04 AM, Björn Pettersson A < bjorn.a.pettersson at ericsson.com> wrote: > It looks quite dangerous to erase the instruction I inside the loop when > iterating over all instructions in the function. > I guess it depends on how the range based iterator is implemented if that > works or not. > > I think
2013 Apr 12
3
[LLVMdev] The line number range of a function in source code level
Hi all, I need to know the line number range of a function. The start of the function line number can be found by the definition point, which is stored at the subprogram metadata: DISubprogram::getLineNumber(). However, there is no API (or the metadata in the first place) to know the end of the function. I have to visit all the instructions of the function and maintain the *max*line number of
2016 Mar 15
7
RFC: DenseMap grow() slowness
There’s a few passes in LLVM that make heavy use of a big DenseMap, one that potentially gets filled with up to 1 entry for each instruction in the function. EarlyCSE is the best example, but Reassociate and MachineCSE have this to some degree as well (there might be others?). To put it simply: at least in my profile, EarlyCSE spends ~1/5 of its time growing DenseMaps. This is kind of… bad.
2010 Apr 21
2
[LLVMdev] How to delete a instruction?
I did a simple test just now, but I alse failed. I delete several ordered instructions from end to begin, but after deleting the first instruction(the last instruction of F), the program crashed. My test code is below (F is a function only containing several sequential instructions): for (inst_iterator inst == --inst_end(F); inst != inst_begin(F); --inst) { Instruction * i = &*inst;
2016 May 29
1
How to find variable names from LLVM IR?
If I have an operand as a Value from an instruction like: Value* V = opnd->get(); and I am sure this is a variable, I want to know the variable name (in source code) for this Value object. I am doing it like this: const Function* Func; if (const Argument* Arg = dyn_cast<Argument>(V)) { Func =
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Hello, I think there's a rather subtle problem with the inst_iterator. It declares its iterator category as std::bidirectional_iterator_tag but C++ standard requirements for forward iterator (which are included in requirements for bidirection iterator), say that the type of expression *r; should be T&, where 'r' is the iterator and T is its value type. The inst_iterator,