Displaying 20 results from an estimated 254 matches for "erasefrompar".
2018 Aug 07
2
Error Calling eraseFromParent()
The code is really simple. But I can not the reason for the segmentation
fault. I only know that the eraseFromParent() function leads to it. The
whole code is:
...
bool runOnFunction(Function &F) override {
for (auto &I : instructions(F)) {
if (auto* op = dyn_cast<BinaryOperator>(&I)) {
IRBuilder<> builder(op);
Value* lhs = op->getOperand(0);
Value* rhs = op->getOperand(1);
Val...
2018 Aug 08
2
Error Calling eraseFromParent()
...t;BinaryOperator>(I)) {
IRBuilder<NoFolder> builder(op);
Value* lhs = op->getOperand(0);
Value* rhs = op->getOperand(1);
Value* mul = builder.CreateMul(lhs, rhs);
for (auto& U : op->uses()) {
User* user = U.getUser();
user->setOperand(U.getOperandNo(), mul);
}
//I->eraseFromParent();
dels.push_back(I);
}
}
for (auto &I : dels) {
I->eraseFromParent();
}
...
On Wed, Aug 8, 2018 at 6:16 PM, mayuyu.io <admin at mayuyu.io> wrote:
> Hi:
> As stated in the documentation you shouldn’t modify it while iterating as
> this invalidates the iterator. Try save...
2018 Nov 27
2
GlobalVariable::eraseFromParent
I am confused by GlobalVariable::eraseFromParent's declaration:
/// This method unlinks 'this' from the containing module and deletes it.
void eraseFromParent();
In Globals.cpp the unlinking is done and SymbolTableListTraits cleans up
the symbol table but I don't see anything that actually deletes the
object. Is the comm...
2012 Apr 21
4
[LLVMdev] Remove function from module
Thanks, but I replaceAllUsesWith() - works well, but I still get bug in eraseFromParent():
While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
An asserting value handle still pointed to this value!
UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
Yours sincerely,
Kadysev Mikhail
21.04.2012, в 23:45, Nick Lewycky написал(а):
> Михаил wrote:
>&g...
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 assert when you build LLVM with this
> code in Debug Mode or is it simpl...
2018 Aug 07
2
Error Calling eraseFromParent()
...; From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Ahmad
> Nouralizadeh via llvm-dev <llvm-dev at lists.llvm.org>
> Sent: Tuesday, August 7, 2018 22:26
> To: paul.robinson at sony.com
> Cc: llvm-dev at lists.llvm.org
> Subject: Re: [llvm-dev] Error Calling eraseFromParent()
>
> The code is really simple. But I can not the reason for the segmentation
> fault. I only know that the eraseFromParent() function leads to it. The
> whole code is:
> ...
> bool runOnFunction(Function &F) override {
>
> for (auto &I : instructions(F)) {
>...
2018 Aug 07
2
Error Calling eraseFromParent()
...p = dyn_cast<BinaryOperator>(&I)) {
Value* lhs = op->getOperand(0);
Value* rhs = op->getOperand(1);
Value* mul = builder.CreateMul(lhs, rhs);
for (auto& U : op->uses()) {
User* user = U.getUser();
user->setOperand(U.getOperandNo(), mul);
}
I.eraseFromParent();
}
...
This leads to the following runtime error:
LLVMSymbolizer: error reading file: No such file or directory
...
Does anybody know the solution?
Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/...
2012 Apr 21
3
[LLVMdev] Remove function from module
How correctly remove function from module?
For example:
int f1(int x) {
...
a = f2(smth);
...
}
int f2 (int y) {
...
b = f1(smth);
...
}
I need delete from module both f1 and f2. They haven't uses in other part of module, but I can't delete them with eraseFromParent, because they are use each other.
Yours sincerely,
Kadysev Mikhail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120421/8f492716/attachment.html>
2012 Apr 21
0
[LLVMdev] Remove function from module
...module?
> For example:
>
> int f1(int x) {
> ...
> a = f2(smth);
> ...
> }
> int f2 (int y) {
> ...
> b = f1(smth);
> ...
> }
>
> I need delete from module both f1 and f2. They haven't uses in other
> part of module, but I can't delete them with eraseFromParent, because
> they are use each other.
Call X->replaceAllUsesWith(UndefValue::get(X->getType)) before calling
X->eraseFromParent().
Nick
2012 Apr 22
0
[LLVMdev] Remove function from module
Михаил wrote:
> Thanks, but I replaceAllUsesWith() - works well, but I still get bug in
> eraseFromParent():
>
> While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
> An asserting value handle still pointed to this value!
> UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
The replaceAllUsesWith + eraseFromParent pattern remains correct, but
there's more to...
2012 Apr 22
2
[LLVMdev] Remove function from module
It is ModulePass with AnalysisUsage of CallGraph
Yours sincerely,
Kadysev Mikhail
22.04.2012, в 5:20, Nick Lewycky написал(а):
> Михаил wrote:
>> Thanks, but I replaceAllUsesWith() - works well, but I still get bug in
>> eraseFromParent():
>>
>> While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
>> An asserting value handle still pointed to this value!
>> UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
>
> The replaceAllUsesWith + eraseFromParent pattern remains correct...
2010 Jun 21
0
[LLVMdev] Problems with eraseFromParent()
...dant
> unused instructions from the generated code, there is a seg fault error.
> To remove them, I'm using this function:
>
> void EraseInst(Instruction &I) {
> assert(I.use_empty() && "Cannot erase used instructions!");
> I.eraseFromParent();
> }
The problem is in how you use it:
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;
I++) {
if (I->use_empty() && dyn_cast<LoadInst>(I)) {
errs() << "*****Instruction unused*****" << "\n";...
2010 Jun 21
3
[LLVMdev] Problems with eraseFromParent()
...ally attempt to remove the redundant unused
instructions from the generated code, there is a seg fault error.
To remove them, I'm using this function:
void EraseInst(Instruction &I) {
assert(I.use_empty() && "Cannot erase used instructions!");
I.eraseFromParent();
}
So please, if anyone could help me on this, i would be very grateful!
PS: It's also following my pass and the bytecode used for tests.
Thanks for the attention,
Alysson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail...
2011 Oct 14
0
[LLVMdev] BasicBlock succ iterator
...BasicBlock * BB = *bi;
for (BasicBlock::iterator ii = BB->begin(), ii2; ii != BB->end();
ii= ii2)
{
ii2 = ii;
ii2++;
Instruction *inst = ii;
inst->replaceAllUsesWith(UndefValue::get(inst->getType()));
inst->eraseFromParent();
}
for (pred_iterator PI = pred_begin(BB); PI != pred_end(BB); ++PI)
{
BasicBlock *pred = *PI;
if (!L->contains(pred))
continue;
pred->getTerminator()->eraseFromParent();
}
BB->eraseFromPare...
2015 Apr 01
2
[LLVMdev] Why the fault?
...or I = BB.rbegin(), E = BB.rend(); I != E; ) {
Instruction& inst = *I;
++I; <-- iterator should be advanced to the previous instruction
// Happens to be an Instruction::SExt.
// Works fine if I iterate forwards
if (isInstructionTriviallyDead(&inst, TLI))
inst.eraseFromParent();
}
Sorry for the inexperienced question, but I'm confused why this works when using a forward iterator, but fails in reverse. The iterator is moved off the current instruction so why would erasing the current instruction cause an error?
-------------- next part --------------
An HTML a...
2012 Apr 22
0
[LLVMdev] Remove function from module
...Use
"CG.removeFunctionFromModule(F);" before deleting it.
Nick
> Yours sincerely,
> Kadysev Mikhail
>
> 22.04.2012, в 5:20, Nick Lewycky написал(а):
>
>> Михаил wrote:
>>> Thanks, but I replaceAllUsesWith() - works well, but I still get bug in
>>> eraseFromParent():
>>>
>>> While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
>>> An asserting value handle still pointed to this value!
>>> UNREACHABLE executed at
>>> /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
>>
>> The replaceAllUsesWith + eras...
2014 Jun 26
2
[LLVMdev] eraseFromParent and stack dump
...the use of a
specified instruction.
This is the code I have written
Instruction *new_instr = BinaryOperator::Create(Instruction::Sub, op1,
op2, "");
b->getInstList().insertAfter(old_instr, new_instr); //b is the BasicBlock
old_instr->replaceAllUsesWith(new_instr);
old_instr->eraseFromParent();
When I print the basic block, I see that my instruction was inserted
and replaces the old instruction, however I get a stack dump, when I run
the instrumented IR file.
0 opt 0x00000000014680df
llvm::sys::PrintStackTrace(_IO_FILE*) + 38
1 opt 0x000000000146835c...
2013 Mar 27
2
[LLVMdev] cyclical use between caller and callee
Hi,
I have two functions in a module, X.foo, which is the callee, and
Y.foo2, which calls X.foo.
If i either try to run llvm::Function::eraseFromParent() on any one of
the functions, i'll
get this assertion error:
F is used in instruction:
%"calling function" = call i32 @X.foo(i32 %read)
F is used in instruction:
%"calling function" = call i32 @X.foo(i32 %read)
While deleting: i32 (i32)* %X.foo
Use still stuck aroun...
2010 Mar 23
1
[LLVMdev] How to avoid memory leaks
...ing LLVM IRBuilder (trunk version)
>>
>> Basically I recreate a function over and over again, and pretty sure
>> that my code doesn't cause the leak
>> while(true)
>> {
>> Function *fn = module->getFunction(name);
>> if (fn)
>> fn->eraseFromParent();
>
> Err, shouldn't you delete fn here? I'm pretty sure that this just
> removes the function from the module.
Doxygen says that:
"eraseFromParent - This method unlinks 'this' from the containing
module and deletes it."
so it should be fine just calling er...
2011 Oct 05
2
[LLVMdev] replacing a global variable by a constant
...ariable by a constant value for erase
instruction. i had seen the code that as follows
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();
}
but i dont know how can declare constptr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111005/35b8a0c8/attachment.html>