search for: getmdkindid

Displaying 20 results from an estimated 22 matches for "getmdkindid".

2019 Jul 03
2
optimisation issue in an llvm IR pass
...T(Incr, ConstantInt::get(Int8Ty, 1)); Incr = IRB.CreateAdd(Incr, cf); //interestingly this totally different approach creates the same instructions as variant2 CallInst *AddOv = IRB.CreateBinaryIntrinsic(Intrinsic::uadd_with_over flow, Counter, ConstantInt::get(Int8Ty, 1)); AddOv->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None)); Value *SumWithOverflowBit = AddOv; Incr = IRB.CreateAdd(IRB.CreateExtractValue(SumWithOverflowBit, 0), IRB.CreateZExt(IRB.CreateExtractValue(SumWithOverflowBit, 1), Int8Ty)); So - How do I have to write the code that the target code has a chance of b...
2019 Jul 03
3
optimisation issue in an llvm IR pass
...eAdd(Incr, carry); it makes no difference to the generated assembly > Have you tried using the llvm.uadd.with.overflow.i8 intrinsic? we have tried this: CallInst *AddOv = IRB.CreateBinaryIntrinsic(Intrinsic::uadd_with_overflow, Counter, ConstantInt::get(Int8Ty, 1)); AddOv->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None)); Value *SumWithOverflowBit = AddOv; Incr = IRB.CreateAdd(IRB.CreateExtractValue(SumWithOverflowBit, 0), IRB.CreateZExt(IRB.CreateExtractValue(SumWithOverflowBit, 1), Int8Ty)); but that generated exactly the same as auto cf = IRB.CreateICmpULT(Inc...
2010 Mar 16
4
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
Török Edwin wrote: > [snip] > > Ah, the method got moved to the instruction itself! > > dbgKind = Context->getMDKindID("dbg"); > if (MDNode *Dbg = I->getMetadata(dbgKind)) { > ... > Thanks! This appears to work. I also have code that looks up debug information for GlobalVariables and regular LLVM Value *'s. For the former, I think I can look up their debug information by using the...
2010 Aug 06
1
[LLVMdev] How to access Debug Type Information (from Cbackend)
...ck here: if(StructType* pST=dyn_cast<StructType*>(I)) //check it's a struct (or class) { LLVMContext c; pST->getMetadataTy(c); //get the context //how do I get the debug info //how do I enumerate the base classes?? //MDNode *N=c.getMDKindID("dbg"); I spend some time looking at the doxygen docu etc but didn't find a useful hint. Thx, Alex
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
Török Edwin wrote: > [snip] >>> Something like this (you can of course cache TheMetadata and MDDbgKind) >>> >>> llvm::MetadataContext *TheMetadata = M->getContext().getMetadata(); >>> MDDbgKind = TheMetadata->getMDKind("dbg"); >>> if (MDDbgKind) { >>> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) { >>>
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...t;> LLVM 2.7 branch was created? >>> >> >> It should be there, include/llvm/Metadata.h. >> > > Odd. I just looked in there, and MetadataContext is not defined in that > file. Ah, the method got moved to the instruction itself! dbgKind = Context->getMDKindID("dbg"); if (MDNode *Dbg = I->getMetadata(dbgKind)) { ...
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
On 03/16/2010 06:52 PM, John Criswell wrote: > Török Edwin wrote: >> [snip] >> >> Ah, the method got moved to the instruction itself! >> >> dbgKind = Context->getMDKindID("dbg"); >> if (MDNode *Dbg = I->getMetadata(dbgKind)) { >> ... >> > > Thanks! This appears to work. Ok. > > I also have code that looks up debug information for GlobalVariables and > regular LLVM Value *'s. For the former, I think I can loo...
2014 Jan 23
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
...seemed to have problems grabbing the dbg info [3]. Any idea how I can modify the code [0] to solve the problem? Attached is the bitcode file used as an example in this mail. It was complied with clang v3.3 -g -O0. Thanks, James [0] llvm::LLVMContext llvmContext; unsigned dbgKind = llvmContext.getMDKindID("dbg"); if (MDNode *N = instruction.getMetadata(dbgKind)){ DILocation location(N); fileDirectoryName = location.getDirectory(); fileName = location.getFilename(); lineNumber = location.getLineNumber(); columnNumber = location.getColumnNumber(); } [1] int main(i...
2010 Oct 25
2
[LLVMdev] Prevent instruction elimination
Hi, John Criswell-4 wrote: > > > You may want to use LLVM Metadata features. Search for MDNode in the > doxygen docs for some information on how to create metadata. > > I use metadata information in this way: unsigned mk = Context.getMDKindID(mdtype); Value *V = MDString::get(Context,StringRef(str)); MDNode* n = MDNode::get(Context, &V, 1); inst->setMetadata(mk, n); Maybe it is a deprecated way of handling metadata, as I started with this code from LLVM 2.6. But what I need is a dummy instruction (&quot...
2013 May 02
4
[LLVMdev] int to StringRed conversion
Hello everyone, I have an integer and I want to convert it to StringRef in order to set metadata. setMetadata->(StringRef, MDNode*); It is there a native LLVM way to do it? 1. In the llvm::APSInt Class is toString() method, which seems it is not for this purpose 2. itoa and string are not part of LLVM 3. stringstream is not part of LLVM 4. to_string is not part of LLVM 5. any casting method?
2013 May 02
2
[LLVMdev] int to StringRed conversion
...mail.com> wrote: >> >>> Thank you for your help! >>> >>> Almost solved my problem. Now I don't have any compilation errors. I >>> have only one segfault: >>> >>> opt: LLVMContext.cpp:147: unsigned int >>> llvm::LLVMContext::getMDKindID(llvm::StringRef) const: Assertion >>> `isValidName(Name) && "Invalid MDNode name"' failed. >>> >>> This is due because when I setMetadata() it failes. >>> >>> StringRef tsts = llvm::Twine(srsr).str(); >>> .... >>>...
2014 Jan 24
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
...solve the problem? Attached is >> the bitcode file used as an example in this mail. It was complied with >> clang v3.3 -g -O0. >> >> Thanks, >> James >> >> [0] >> >> llvm::LLVMContext llvmContext; >> >> unsigned dbgKind = llvmContext.getMDKindID("dbg"); >> >> if (MDNode *N = instruction.getMetadata(dbgKind)){ >> >> DILocation location(N); >> >> fileDirectoryName = location.getDirectory(); >> >> fileName = location.getFilename(); >> >> lineNumber = locatio...
2013 May 02
0
[LLVMdev] int to StringRed conversion
...t; alexandruionutdiaconescu at gmail.com> wrote: > >> Thank you for your help! >> >> Almost solved my problem. Now I don't have any compilation errors. I have >> only one segfault: >> >> opt: LLVMContext.cpp:147: unsigned int >> llvm::LLVMContext::getMDKindID(llvm::StringRef) const: Assertion >> `isValidName(Name) && "Invalid MDNode name"' failed. >> >> This is due because when I setMetadata() it failes. >> >> StringRef tsts = llvm::Twine(srsr).str(); >> .... >> LLVMContext& C = is->...
2013 May 02
0
[LLVMdev] int to StringRed conversion
...>>>> Thank you for your help! >>>> >>>> Almost solved my problem. Now I don't have any compilation errors. I >>>> have only one segfault: >>>> >>>> opt: LLVMContext.cpp:147: unsigned int >>>> llvm::LLVMContext::getMDKindID(llvm::StringRef) const: Assertion >>>> `isValidName(Name) && "Invalid MDNode name"' failed. >>>> >>>> This is due because when I setMetadata() it failes. >>>> >>>> StringRef tsts = llvm::Twine(srsr).str(); >>&gt...
2010 Aug 06
0
[LLVMdev] [LLVMDev] [Patch] a utils/GenLibDeps.pl patch for running it on Windows
Hello > I found utils/GenLibDeps.pl cann't run on Windows, so I fix it, made a patch > on svn-110435. I submit this patch, hope it can be accepted. It definitely works for me on windows (not only for me, but for many others too). Which problems you're seeing? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
2010 Oct 25
0
[LLVMdev] Prevent instruction elimination
On 10/25/10 4:13 AM, Xinfinity wrote: > Hello, > > Does there exist something like a "dummy" instruction that is not removed by > the optimizers, even if it seems to be dead code? > I want to use such instructions to carry metadata information, but they > should have a minimal impact on the code generation and optimization. I used > an add instruction: You may want
2010 Aug 06
3
[LLVMdev] [LLVMDev] [Patch] a utils/GenLibDeps.pl patch for running it on Windows
Hi I found utils/GenLibDeps.pl cann't run on Windows, so I fix it, made a patch on svn-110435. I submit this patch, hope it can be accepted. Thanks for your time. Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100806/d2e10f3e/attachment.html> -------------- next part -------------- A
2010 Oct 25
0
[LLVMdev] Prevent instruction elimination
...gt; Hi, > > > John Criswell-4 wrote: >> >> You may want to use LLVM Metadata features. Search for MDNode in the >> doxygen docs for some information on how to create metadata. >> >> > I use metadata information in this way: > unsigned mk = Context.getMDKindID(mdtype); > Value *V = MDString::get(Context,StringRef(str)); > MDNode* n = MDNode::get(Context,&V, 1); > inst->setMetadata(mk, n); > > Maybe it is a deprecated way of handling metadata, as I started with this > code from LLVM 2.6. I think most of the met...
2013 May 02
0
[LLVMdev] int to StringRed conversion
Hi, I think you may try to use llvm::Twine(int). For example, to convert 30 to string, you can use: Twine(30).str() To convert the string back to integer, you can try the StringRef::getAsInteger(unsigned, APInt &). For example: APInt i; str.getAsInteger(/*radix=*/ 10, /*output=*/ i); Sincerely, Logan On Thu, May 2, 2013 at 9:53 PM, Alexandru Ionut Diaconescu <
2010 Oct 26
0
[LLVMdev] Prevent instruction elimination
On Oct 26, 2010, at 9:23 AM, Xinfinity wrote: > > Hello, > > > Devang Patel wrote: >> >> >> On Oct 25, 2010, at 12:09 PM, Xinfinity wrote: >> >>> #pragma my_pragma{ >>> code >>> } >> >>> I use a map >>> (source_location, pragma) and I insert the dummy instruction when this >>> location is