search for: icmp_n

Displaying 15 results from an estimated 15 matches for "icmp_n".

Did you mean: icmp_ne
2017 Nov 17
4
Signed or unsigned EQ/NEQ
Hello, In one of the loop transformations I am developing, I need to convert eq and neq loop latch condition into less than or greater than depending on the control flow. The problem is that CmpInst::ICMP_EQ and CmpInst::ICMP_NE are neither signed nor unsigned in LLVM. Also, I did not find a way to find out if the integer operands of the CmpInst are signed or unsigned. Apparently, LLVM does not distinguish in its type system between signed and unsigned variables. So, I am not able to generate the appropriate signed or uns...
2013 Jan 15
2
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
...<Instruction>(LHSPtr)) - if (Argument *RHSArg = dyn_cast<Argument>(RHSPtr)) - if (LHSInst->getParent()->getParent() == RHSArg->getParent() && - Pred == CmpInst::ICMP_EQ) - return ConstantInt::get(ITy, false); + case ICmpInst::ICMP_NE: + return ConstantInt::get(ITy, true); + } } - - // Assume that the constant null is on the right. - if (llvm::isKnownNonNull(LHSPtr) && isa<ConstantPointerNull>(RHSPtr)) { - if (Pred == CmpInst::ICMP_EQ) + if (LHSPtr == RHSPtr) { + switch (Predica...
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
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
2010 May 06
2
[LLVMdev] Back-edge taken count of loops
...on containing a "=", such as: void scop_func(long A[], long n) { long i; for (i = 1; i<= n; i++) A[i] = 1; } after have a look at the code that computing the back-edge taken count, i found that ScalarEvolution could only compute back-edge taken count if the exit condition is ICMP_NE/ICMP_EQ/ICMP_SLT/ICMP_SGT/ICMP_ULT/ICMP_UGT (ignoring "ComputeBackedgeTakenCountExhaustively"), and the function "SimplifyICmpOperands" will try to convert other conditions to the conditions listed above, by doing something like "i <= n" to "i < n+1",...
2011 Sep 19
2
[LLVMdev] copy Value object?
Sorry, I'm a bit confused by your reply. I think part of my problem is I can only think of this in terms of Passes. For instance, my pass looks for assignments and tries to use the same pointer operand, before the assignment it finds. Like this: new ICmpInst(*block, CmpInst::ICMP_NE, shadow, store->getPointerOperand(), "Shadow check"); So I'm not sure how alloca could help me, seems like it wouldn't be a valid Value * for me to pass in at that point. Am I missing something? Thank you On Mon, Sep 19, 2011 at 2:02 PM, John Criswell <criswell at illino...
2011 Sep 19
0
[LLVMdev] copy Value object?
...a bit confused by your reply. I think part of my problem is > I can only think of this in terms of Passes. > > For instance, my pass looks for assignments and tries to use the same > pointer operand, before the assignment it finds. Like this: > new ICmpInst(*block, CmpInst::ICMP_NE, shadow, > store->getPointerOperand(), "Shadow check"); Can you clarify what you mean by "an assignment?" Do you mean an LLVM store instruction, or do you mean an SSA assignment of an LLVM virtual register? > > So I'm not sure how alloca could help me, seems...
2010 Feb 12
2
[LLVMdev] [PATCH] Fix off-by-one errors in the doxygen documentation
...+ FCMP_UNE = 14, ///< 1 1 1 0 True if unordered or not equal + FCMP_TRUE = 15, ///< 1 1 1 1 Always true (always folded) FIRST_FCMP_PREDICATE = FCMP_FALSE, LAST_FCMP_PREDICATE = FCMP_TRUE, BAD_FCMP_PREDICATE = FCMP_TRUE + 1, - ICMP_EQ = 32, /// equal - ICMP_NE = 33, /// not equal - ICMP_UGT = 34, /// unsigned greater than - ICMP_UGE = 35, /// unsigned greater or equal - ICMP_ULT = 36, /// unsigned less than - ICMP_ULE = 37, /// unsigned less or equal - ICMP_SGT = 38, /// signed greater than - ICMP_SGE = 39, /// si...
2013 Jan 16
0
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
...rg = A->hasByValAttr(); + } - // Assume that the constant null is on the right. - if (llvm::isKnownNonNull(LHSPtr) && isa<ConstantPointerNull>(RHSPtr)) { - if (Pred == CmpInst::ICMP_EQ) - return ConstantInt::get(ITy, false); - else if (Pred == CmpInst::ICMP_NE) - return ConstantInt::get(ITy, true); - } - } else if (Argument *LHSArg = dyn_cast<Argument>(LHSPtr)) { - RHSPtr = RHSPtr->stripInBoundsOffsets(); - // An alloca can't be equal to an argument unless they come from separate - // functions via inlining. - if (All...
2010 May 06
0
[LLVMdev] Back-edge taken count of loops
...> void scop_func(long A[], long n) { > long i; > > for (i = 1; i<= n; i++) > A[i] = 1; > } > > after have a look at the code that computing the back-edge taken count, i found that ScalarEvolution could only compute back-edge taken count if the exit condition is ICMP_NE/ICMP_EQ/ICMP_SLT/ICMP_SGT/ICMP_ULT/ICMP_UGT (ignoring "ComputeBackedgeTakenCountExhaustively"), and the function "SimplifyICmpOperands" will try to convert other conditions to the conditions listed above, by doing something like "i <= n" to "i < n+1",...
2011 Oct 12
2
[LLVMdev] insert ICmpInst/BranchIns in Pass?
...inst_iterator i, GlobalVariable *shadow, Value *val) { /* Split old Block */ BasicBlock *bb = i->getParent(); BasicBlock *bb_after = i->getParent()->splitBasicBlock(&*i); bb->getTerminator()->eraseFromParent(); /* Test */ ICmpInst *test = new ICmpInst(*bb, CmpInst::ICMP_NE, shadow, val, "Shadow check"); /* Fail */ BasicBlock *trueBlock = BasicBlock::Create(M.getContext(), "Shadow Check FAIL", &F); CallInst::Create(qv_segFault, "", trueBlock); BranchInst::Create(bb_after, trueBlock); /* Profit */ BranchInst::Create(...
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
...*Con; + if (!((Con = dyn_cast<ConstantInt>(LHS)) || (Con = dyn_cast<ConstantInt>(RHS)))) + return nullptr; + uint64_t con_val = Con->getZExtValue(); + + if (RHS == CI) + IC->swapOperands(); + + switch (IC->getPredicate()) { + case ICmpInst::ICMP_EQ: + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_SLE: + // XXX: check for wrapping + if (con_val == UINT64_MAX) + return nullptr; + return emitStrNLen(Src, ConstantInt::...
2011 Sep 19
0
[LLVMdev] copy Value object?
On 9/19/11 12:53 PM, ret val wrote: > Is there a easy way to copy a Value object, so it can be used in > multiple instructions without a dominance issue? A value object can be used multiple times with no problem. The dominance problem stems from the fact that the program must be in SSA form. When the program uses a value, it must have been defined dynamically for all possible executions
2011 Sep 19
2
[LLVMdev] copy Value object?
Is there a easy way to copy a Value object, so it can be used in multiple instructions without a dominance issue?
2014 Dec 08
3
[LLVMdev] Incorrect loop optimization when building the Linux kernel
I was trying to build the Linux kernel with clang and observed a crash due to incorrect loop optimization: drivers/base/firmware_class.c extern struct builtin_fw __start_builtin_fw[]; extern struct builtin_fw __end_builtin_fw[]; static bool fw_get_builtin_firmware(struct firmware *fw, const char *name) { struct builtin_fw *b_fw; for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw;