Displaying 1 result from an estimated 1 matches for "con_val".
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
...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 = 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::ICM...