similar to: [LLVMdev] Remove function from module

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] Remove function from module"

2012 Apr 21
0
[LLVMdev] Remove function from module
Михаил wrote: > 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
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: >> How correctly
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! >>
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
2012 Apr 22
0
[LLVMdev] Remove function from module
Михаил wrote: > It is ModulePass with AnalysisUsage of CallGraph Ah, then you'll need to update the CallGraph first. 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
2012 Apr 21
0
[LLVMdev] Remove function from module
It also occurs on several (different) test cases. I have founded that assershion rises in void ValueHandleBase::ValueIsDeleted(Value *V); Code from function: // All callbacks, weak references, and assertingVHs should be dropped by now. if (V->HasValueHandle) { #ifndef NDEBUG // Only in +Asserts mode... dbgs() << "While deleting: " << *V->getType()
2020 Jun 17
2
InstCombine doesn't delete instructions with token
Hello David, I am having an issue with some custom intrinsics that return a token value: InstCombine deletes the users of the token but not the instruction that creates the token itself. The IR is still valid but it's wasted. The source of the issue is coming from an old patch of yours: commit 7204cff0a121ebc770cf81f7f94679ae7324daae Author: David Majnemer <david.majnemer at
2013 Oct 24
2
[LLVMdev] LLVM use chains
On 10/24/13 2:13 AM, Rafael Espíndola wrote: > On 23 October 2013 22:41, Vassil Vassilev <vvasilev at cern.ch> wrote: >> Hi, >> I have: >> ... >> @.str1 = private unnamed_addr constant [21 x i8] c"Now f is a >> function\0A\00", align 1 >> ; Function Attrs: ssp uwtable >> define i32 @_Z1fv() #2 { >> entry: >> %call =
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
2013 Apr 02
1
[LLVMdev] cyclical dependence between caller and callee in JIT
2013/3/27 Nick Lewycky <nicholas at mxc.ca>: >The common idiom to delete any Value* is: > > V->replaceAllUsesWith(UndefValue::get(V->getType()); > V->eraseFromParent(); > > Does that work for functions? You may need to make sure the 'undef' has a > pointer to function type instead of the function type. > I tried this code sample, passing the type
2020 Jun 17
2
InstCombine doesn't delete instructions with token
Yes, it's still respected in this case, as the only instructions that will be deleted have been RAUW with undef. Originally, all instructions where RAUW but only non-EHPad were deleted (that means EHPad were RAUW but not deleted). Then it was later patched by not RAUW token instructions and now not deleting EHPad nor token instructions. My assumption is that the instructions we wanted to
2011 Oct 14
0
[LLVMdev] BasicBlock succ iterator
Hi I have checked all blocks, each block have a Terminator instruction and each blocks belongs to a function. I'm really confused. I guess the problem is caused by the removal of the Loop,The code is as follows: * //every block to header (except the ones in the loop), will now redirect to newblock for (pred_iterator PI = pred_begin(header); PI != pred_end(header); ++PI) {
2013 Oct 24
0
[LLVMdev] LLVM use chains
>> You probably want replaceAllUsesWith. > > I am sorry I don't understand. Are you suggesting calling replaceAllUses of > the .str1? What I really want to do is to 'erase' the function. By erasing > I'd expect the uses of .str1 to 0 (because in the example I have it is used > only by f()) and I see they are not. To remove something, the normal idiom is
2020 Jun 17
2
InstCombine doesn't delete instructions with token
I did not observe any assertion. In addition, the documentation ( https://llvm.org/docs/LangRef.html#undefined-values) says: The string ‘undef’ can be used anywhere a constant is expected, and indicates that the user of the value may receive an unspecified bit-pattern. Undefined values may be of any type (other than ‘label’ or ‘ void’) and be used anywhere a constant is permitted. Either way,
2011 Oct 06
1
[LLVMdev] replacing a global variable by a constant
I would delete the Loop. I used the following code. cout << "begin to delete loop" << endl; for (Loop::block_iterator bi = L->block_begin(), bi2; bi != L->block_end(); bi = bi2) { bi2 = bi; bi2++; BasicBlock * BB = *bi; for (BasicBlock::iterator ii = BB->begin(), ii2; ii != BB->end(); ii= ii2) { ii2 = ii;
2011 Oct 13
6
[LLVMdev] BasicBlock succ iterator
Hi, All I want to implement DSWP Which is used for parallelization of loops. For this purpose, the loop was replaced with a new basic block in main function. And new functions were created and basic blocks of Loop assigned to them.I have checked blocks and branches for Succ and Pred relation and I have not found any problems. However I get the following error: * **opt:
2012 May 04
2
[LLVMdev] StructTypes into one
Is it possible to merge StructTypes with different names like: %"class.std::allocator.4" = type { i8 } %"class.__gnu_cxx::new_allocator.5" = type { i8 } %"class.std::allocator.0" = type { i8 } %"class.__gnu_cxx::new_allocator.1" = type { i8 } %"class.std::allocator.0.6" = type { i8 } merge into %"class.__gnu_cxx::new_allocator" = 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
2020 May 15
2
Issues with new Attributor (replaceAllUses fails with type mismatch)
[AMD Official Use Only - Internal Distribution Only] Hi , There seems to be some issue with attributor, exactly in File Attributor.cpp, Function Attributor::rewriteFunctionSignatures(), Line No: 1600 (approrimate). The llvm source code at above address is as follows: // Eliminate the instructions *after* we visited all of them. for (auto &CallSitePair : CallSitePairs) {
2012 Jun 18
2
[LLVMdev] Which pass converts call printf to puts?
Ok. So it seems CI->eraseFromParent() removed the old instruction and the new one is inserted right after this one in the inner function in the case of printf->puts. There is another line CI->repalceAllUsesWith(Result). I think this line could also do the replacement besides inserting the new one in the inner function. What's the difference of these 2 replacement methods? Also