Displaying 20 results from an estimated 11000 matches similar to: "[LLVMdev] ReplaceInstWithInst appears to invalidate BB iterator?"
2011 May 07
1
[LLVMdev] ReplaceInstWithInst appears to invalidate BB iterator?
On May 7, 2011, at 1:00 PM, llvmdev-request at cs.uiuc.edu wrote:
>
> Hi Justin,
>
>> I have a call to ReplaceInstWithInst(Instruction *From, Instruction *To) inside of a for loop iterating through a BasicBlock::iterator. On the very next pass after I replace the instruction, the iterator appears to be invalidated. Is this supposed to happen or am I doing something silly? Is
2016 Jun 21
3
function call replacement
Hi,
Thanks both of you for the help. I just missed that Create function had
many optional arguments... sorry for that. However my problem wasn't coming
from here (IRBuilder CreateCall function still return a pointer to CallInst
so I just added 2 times the call?). I didn't wanted to detail the all issue
previously because I knew I had a problem with my syntax. So here's my
problem:
I
2019 May 17
3
Copy Function from one LLVM IR file to another
Hello everyone,
I wanted to copy a function from one file to another. The file that I
wanted to copy the function into contains a function with the same name and
same number of instructions. I decided to just replace the instructions
with those of the other function. I am doing all of this from within a
function pass.
*1.* I created a function pass in which I extract a function using
2015 Jun 18
3
[LLVMdev] problem with replacing an instruction
I am trying to change this
define void @main(float* noalias %arg0, float* noalias %arg1, float*
noalias %arg2) {
entrypoint:
%0 = bitcast float* %arg1 to <4 x float>*
intothis
define void @main(float* noalias %arg0, float* noalias %arg1, float*
noalias %arg2) {
entrypoint:
%0 = getelementptr float* %arg1, i64 0
%1 = bitcast float* %0 to <4 x float>*
I must be close but
2013 Dec 06
0
[LLVMdev] ReplaceInstWithInst problem
Hi,
In my source code, I have the following declaration char a[30];
When I'm running the following (Assuming that I is an instruction pointer pointing to the instruction to be replaced, i.e. %a = alloca [30 x i8], align 1):
ArrayType* arr = ArrayType::get(IntegerType::get(getGlobalContext(), 8), 10);
AllocaInst* pa = new AllocaInst(arr, "blah");
BasicBlock::iterator ii(*I);
2016 Jun 20
3
function call replacement
Hi everyone,
I am trying to replace the call of a certain function with a call to
another function. It would for example replace the following:
%call = tail call noalias i8* @func(i64 10)
by
%call = tail call noalias i8* @other_func(i64 10)
I managed to declare other_func correctly but I am having troubles to
understand how I should proceed to do the replacement.
I tried to use
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
2009 Nov 18
2
[LLVMdev] Strange error using CallInst constructor
Hi,
This is probably more of a standard C++ question instead of an actual
LLVM question, but here it goes anyway. I'm trying to invoke the
following constructor:
CallInst::CallInst(Value *Func, InputIterator ArgBegin, InputIterator
ArgEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd);
My code is:
using namespace llvm;
void replaceByClone(Function *f, CallInst *I){
Function *clone =
2008 May 23
0
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
On May 23, 2008, at 4:10 AM, Nicolas Capens wrote:
> Hi all,
>
> I updated from 2.2 to the latest SVN head and I now get a debug
> assert in BranchFolder::RemoveBlocksWithHash: “vector iterators
> incompatible”. I’m using Visual C++ 2005. I think this is the
> culprit code:
>
> MergePotentials.erase(CurMPIter);
> if (CurMPIter==B)
> break;
>
2008 May 23
3
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
Hi all,
I updated from 2.2 to the latest SVN head and I now get a debug assert in
BranchFolder::RemoveBlocksWithHash: "vector iterators incompatible". I'm
using Visual C++ 2005. I think this is the culprit code:
MergePotentials.erase(CurMPIter);
if (CurMPIter==B)
break;
The erase clears the _Mycont field (i.e. the iterator's container), while
the ==
2009 Jun 24
3
[LLVMdev] Replacing instruction in LLVM IR by an intrinsics
Hi everyone,
I am trying to write a pass, that finds some instructions and replaces them with my intrinsics,
but I am having problem understanding, how this should be done.
Let's say I have this instruction:
%tmp14 = load i32* getelementptr ([32 x i32]* @gpregs, i32 0, i64 28)
and i need to read the load's operands and replace it by let's say:
%tmp14 = call i32
2004 Dec 07
1
[LLVMdev] Question adding dummy basic blocks
Hi,
I got a problem when I am trying to add a dummy basic block.
Let say there are two blocks, A and B.
A----->B
I am trying to generate new BB called C which is located between A and B, but not break the edge of AB. The graph is like the following
A---->B
\ /
\ /
C
There is new BB 'C' with edges AC and CB.
It is kind of like what breakcriticaledge pass does.
2013 Dec 03
1
[LLVMdev] Help with creating and replacing instructions in LLVM
Hi,
I have the following instruction in my IR-
%call2 = call i8* @strcpy(i8* %1, i8* %2) #2
I intend to change call to strcpy with strncpy. I have included the following code in runOnFunction, so that when it is strcpy's turn to be invoked, strncpy is invoked instead.
Assuming I* is the strcpy instruction,
CallInst* x=new
2013 Dec 03
1
[LLVMdev] Help needed with creating new and replacing an old instruction
Hi,I have the following instruction in my IR-%call2 = call i8* @strcpy(i8* %1, i8* %2) #2I intend to change call to strcpy with strncpy. I have included the following code in runOnFunction, so that when it is strcpy's turn to be invoked, strncpy is invoked instead.Assuming I* is the strcpy instruction,CallInst* x=new
2002 Sep 26
2
[LLVMdev] modify instructions
Hi, I have a question about the modify of instruction:
Say I want to modify
%a = getelementptr %struct %S, long 0, ubyte 1
into
%a.f0 = getelementptr int* %S.f0, long 0
There are 3 ways I can think of to implement, but I'm not sure
what should I do.
1. I can use new GetElementPtr to create a new instruction and
use ReplaceInstWithInst() function to replace the old one.
2. I can use new
2008 May 27
2
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
On May 23, 2008, at 10:19 AM, Dale Johannesen wrote:
> On May 23, 2008, at 4:10 AM, Nicolas Capens wrote:
>
>> I updated from 2.2 to the latest SVN head and I now get a debug
>> assert in BranchFolder::RemoveBlocksWithHash: “vector iterators
>> incompatible”. I’m using Visual C++ 2005. I think this is the
>> culprit code:
>>
>>
2013 Jul 31
1
[LLVMdev] Problem to remove successors
Hi All,
I need to remove successors from every basic block to insert new ones
I tried this code, but it doesn't work
void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
assert(SuccNum < TI->getNumSuccessors() &&
"Trying to remove a nonexistant successor!");
// If our old successor block contains any PHI nodes, remove the entry
in the
//
2008 May 27
2
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
On May 27, 2008, at 2:01 PM, Dale Johannesen wrote:
> On May 27, 2008, at 1:40 PM, Mike Stump wrote:
>>
>> From n2461:
>>
>>> 8 The insert members shall not affect the validity of iterators and
>>> references to the container, and the erase members shall invalidate
>>> only iterators and references to the erased elements.
>>
>> Pretty
2007 Dec 04
2
[LLVMdev] SmallPtrSet Iterator Behavior
What are the rules regarding iterator stability for SmallPtrSet?
I'm running into a problem where erasing an element seems
to invalidate iterators that are not pointing at the erased element.
Specifically, the set is in small mode, I advance an iterator to the last
element in the set (not end(), but one before) and then erase the
second-to-last element. I understand that the last element
2008 May 27
0
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
On May 27, 2008, at 1:40 PM, Mike Stump wrote:
> On May 23, 2008, at 10:19 AM, Dale Johannesen wrote:
>> On May 23, 2008, at 4:10 AM, Nicolas Capens wrote:
>> I also am not a STL guru; the standard says erase
>> "Invalidates all the iterators and references after the point of the
>> erase"
>> which is not wonderfully worded, but I take it to mean an