search for: icmpinst

Displaying 20 results from an estimated 69 matches for "icmpinst".

2013 Jan 10
1
[LLVMdev] LLVM Instruction to ICmpInst conversion
Hello ! I want some piece of advice regarding a LLVM pass. My particular problem is: There is a method bool patternDC::runOnFunction(Function &F) { ... if ( CC->operEquiv(icmpInstrArray[i], icmpInstrArray[j]) ) {...} ... } having the array elements of type Instruction* : http://llvm.org/doxygen/classllvm_1_1Instruction.html The called method is bool ifChecker::operEquiv(Instruction *I1, Instruction *I2) { ... } BUT I want to use the methods from class ICmpInst : clasa ht...
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
...strlenfirst"), CI->getType()); + // strlen(x) < y --> strnlen(x, y+1) < y + // + // We ensure that there is only one user to avoid interfering with + // CSE. + if (!CI->hasOneUse() || !TLI->has(LibFunc::strnlen)) + return nullptr; + User *U = CI->user_back(); + ICmpInst *IC; + if (!(IC = dyn_cast<ICmpInst>(U))) + return nullptr; + IntegerType *SizeType = DL.getIntPtrType(B.GetInsertBlock()->getContext()); + Value *LHS = IC->getOperand(0), *RHS = IC->getOperand(1); + + ConstantInt *Con; + if (!((Con = dyn_cast<ConstantInt>(LHS)) || (Con...
2016 Jul 21
2
Remove zext-unfolding from InstCombine
...xt(icmp)`. In a subsequent iteration these `zext(icmp)` pairs could then (possibly) be optimized by another optimization (which has already been there before r48715), to replace them by bitwise or integer operations. The code in question is located in `visitZExt()` in InstCombineCasts.cpp: ``` if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src)) return transformZExtICmp(ICI, CI); BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src); if (SrcI && SrcI->getOpcode() == Instruction::Or) { // zext (or icmp, icmp) --> or (zext icmp), (zext icmp) if at least one // of the (zext icmp)...
2011 Sep 28
3
[LLVMdev] ICmpInst example?
I'm trying to come up with a simple example of using ICmpInst in a Pass. On each of the branches(true, false) I'd like to call a separate function and then resume(to the code that was already there). In this example i is a inst_iterator to Instruction the Pass is currently on. Now it segfaults opt before I can even get a dump() on it. Does anyone see wha...
2011 Oct 12
2
[LLVMdev] insert ICmpInst/BranchIns in Pass?
In a pass I would like to insert a ICmpInst/BranchInst pair to check if 2 GlobalVariables are equal or not. If they are not I would like to call a function. I've tried splitting the current block and then inserting before the existing instructions, but for some reason this seems to ruin the iterator(i). What is the correct way todo somet...
2010 Apr 17
1
[LLVMdev] SCEV expression for ICmpInst
...y compute what the sign of the difference would be in extended precision. On Apr 17, 2010, at 1:00 PM, llvmdev-request at cs.uiuc.edu wrote: > Message: 13 > Date: Sat, 17 Apr 2010 22:17:54 +0800 > From: ether zhhb <etherzhhb at gmail.com> > Subject: [LLVMdev] SCEV expression for ICmpInst > To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu> > Message-ID: > <s2w5f72161f1004170717re1325ffdr53b6b7308215b3fa at mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > > i am playing the ScalarEvolution these days....
2010 Jul 27
1
[LLVMdev] How to use the return value of a CallInst
...trying to compare the return value of a call instruction with 0. The called function's return type is uint32. The return value is 1 or 0. But the icmp instruction cannot be created. CallInst *ret = CallInst::Create(ptr_func, params.begin(), params.end(), "", bb); Value *cmp = new ICmpInst(*bb, ICmpInst::ICMP_EQ, ret, ,ConstantInt::get(getIntegerType(32), 0) "") The runtime error is: /usr/local/include/llvm/Instructions.h:690: llvm::ICmpInst::ICmpInst(llvm::BasicBlock&, llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, const llvm::Twine&): Assertion `getOperand...
2011 Sep 28
0
[LLVMdev] ICmpInst example?
On Tue, Sep 27, 2011 at 7:28 PM, ret val <retval386 at gmail.com> wrote: > I'm trying to come up with a simple example of using ICmpInst in a > Pass. On each of the branches(true, false) I'd like to call a separate > function and then resume(to the code that was already there). > > In this example i is a inst_iterator to Instruction the Pass is > currently on. Now it segfaults opt before I can even get a dump() on...
2010 Apr 17
2
[LLVMdev] SCEV expression for ICmpInst
Hi, i am playing the ScalarEvolution these days. i found the the ScalarEvolution will simply return a SCEVUnknow for a ICmpInst, so i think maybe great to add a new kind of SCEV to the ScalarEvolution framework. for example, if i run ScalarEvolution on the bc file generate from the following C source file: int f(int a, int b, int c, int d) { return (2 * a + 5 * c + 2) > (4 * d - 3*b +3); } i will get a SCEVUnkno...
2013 Jan 15
2
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
...as analysis and provides the conservative logic for when pointers are not equal. The only really problematic part would be InlineCost.cc, since that could try to replace NoAlias/ByVal arguments with allocas in the same function. For the moment, the inline cost estimation doesn't use the SimplifyICmpInst interface and there are other parts that need to be carefully validated before it can. It doesn't look too bad to add an explicit argument whether interprocedural analysis is being done and restrict the tests for that, but I am leaving this out as it is currently unnecessary. I am also not doi...
2011 Oct 12
0
[LLVMdev] insert ICmpInst/BranchIns in Pass?
On Tue, Oct 11, 2011 at 7:22 PM, ret val <retval386 at gmail.com> wrote: > In a pass I would like to insert a ICmpInst/BranchInst pair to check > if 2 GlobalVariables are equal or not. If they are not I would like to > call a function. I've tried splitting the current block and then > inserting before the existing instructions, but for some reason this > seems to ruin the iterator(i). What is the co...
2012 Dec 12
0
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Dec 12, 2012 at 1:26 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote: > On Wed, Dec 12, 2012 at 11:01:01AM -0800, Dan Gohman wrote: >> > Is that >> > assumption violated if I explicitly cast away const and pass the result >> > to a function with NoAlias argument? >> >> Not immediately, no. It means that you can't access the
2015 Aug 06
2
[LLVMdev] Ideas for making llvm-config --cxxflags more useful
...lags they use, and also would let them choose the correct > flag since, for example, -fno-rtti is not understood by MSVC. There appears to be a regression in LLVM 3.7, which means that you must compile with -fno-rtti if you include llvm’s Instructions.h. The issue is that a few of the classes (ICmpInst, GetElementPtrInst and PHINode) are now defined entirely in the header, so every compilation unit that includes the header will emit them. These classes all inherit from Instruction (indirectly via CmpInst in the case of ICmpInst) and so fail to link if compiled with -fno-rtti, because they can’t...
2016 Jul 27
2
Remove zext-unfolding from InstCombine
...subsequent iteration these `zext(icmp)` pairs could then (possibly) be optimized by another optimization (which has already been there before r48715), to replace them by bitwise or integer operations. The code in question is located in `visitZExt()` in InstCombineCasts.cpp: > > ``` > if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src)) > return transformZExtICmp(ICI, CI); > > BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src); > if (SrcI && SrcI->getOpcode() == Instruction::Or) { > // zext (or icmp, icmp) --> or (zext icmp), (zext icmp) if at least on...
2012 Dec 12
3
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Dec 12, 2012 at 11:01:01AM -0800, Dan Gohman wrote: > > Is that > > assumption violated if I explicitly cast away const and pass the result > > to a function with NoAlias argument? > > Not immediately, no. It means that you can't access the constant > pointer's pointee directly within the noalias argument's scope. Access > to that object must go
2013 Jul 03
2
[LLVMdev] [Polly] Assert in Scope construction
...lity in LNT > infrustructure > > > Tobias, > > I seem to trigger an assert in Polly lib/Analysis/TempScopInfo.cpp > > void TempScopInfo::buildAffineCondition(Value &V, bool inverted, > Comparison **Comp) const { ... > ICmpInst *ICmp = dyn_cast<ICmpInst>(&V); > assert(ICmp && "Only ICmpInst of constant as condition supported!"); ... > > The code it chokes on looks like this (see below). The problem is this OR-ed > compare result: > > %cmp3 = icmp sgt i32 %j.0, 2 >...
2015 Aug 07
2
[LLVMdev] Ideas for making llvm-config --cxxflags more useful
...se the > correct > >> flag since, for example, -fno-rtti is not understood by MSVC. > > > > There appears to be a regression in LLVM 3.7, which means that you must > compile with -fno-rtti if you include llvm’s Instructions.h. The issue is > that a few of the classes (ICmpInst, GetElementPtrInst and PHINode) are now > defined entirely in the header, so every compilation unit that includes the > header will emit them. These classes all inherit from Instruction > (indirectly via CmpInst in the case of ICmpInst) and so fail to link if > compiled with -fno-rtti,...
2013 Jul 05
0
[LLVMdev] [Polly] Assert in Scope construction
...> > > > Tobias, > > > > I seem to trigger an assert in Polly lib/Analysis/TempScopInfo.cpp > > > > void TempScopInfo::buildAffineCondition(Value &V, bool inverted, > > Comparison **Comp) const { ... > > ICmpInst *ICmp = dyn_cast<ICmpInst>(&V); > > assert(ICmp && "Only ICmpInst of constant as condition supported!"); > ... > > > > The code it chokes on looks like this (see below). The problem is this > OR-ed > > compare result: > > > >...
2016 Aug 04
2
Remove zext-unfolding from InstCombine
...eration these `zext(icmp)` pairs could then (possibly) be optimized by another optimization (which has already been there before r48715), to replace them by bitwise or integer operations. The code in question is located in `visitZExt()` in InstCombineCasts.cpp: > > > > ``` > > if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src)) > > return transformZExtICmp(ICI, CI); > > > > BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src); > > if (SrcI && SrcI->getOpcode() == Instruction::Or) { > > // zext (or icmp, icmp) --> or (zext icmp), (z...
2015 Aug 07
3
[LLVMdev] Ideas for making llvm-config --cxxflags more useful
...hoose the correct >> >> flag since, for example, -fno-rtti is not understood by MSVC. >> > >> > There appears to be a regression in LLVM 3.7, which means that you must compile with -fno-rtti if you include llvm’s Instructions.h. The issue is that a few of the classes (ICmpInst, GetElementPtrInst and PHINode) are now defined entirely in the header, so every compilation unit that includes the header will emit them. These classes all inherit from Instruction (indirectly via CmpInst in the case of ICmpInst) and so fail to link if compiled with -fno-rtti, because they can’t...