Displaying 8 results from an estimated 8 matches for "createzext".
2019 Jul 03
3
optimisation issue in an llvm IR pass
Hi Craig,
On 03.07.19 17:33, Craig Topper wrote:
> Don't the CreateICmp calls return a Value* with an i1 type? But then
> they are added to an i8 type? Not sure that works.
I had that initially:
auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1));
auto carry = IRB.CreateZExt(cf, Int8Ty);
Incr = IRB.CreateAdd(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,...
2019 Jul 03
2
optimisation issue in an llvm IR pass
...st *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 being generated?
For me its the same result on LLVM 6.0 and 7.
Alternatively
add BYTE PTR [rsi+rdi*1],0x1
adc BYTE PTR [rsi+rdi*1],0x0
would work as well....
2016 Jul 21
2
Remove zext-unfolding from InstCombine
...tOperand(0));
ICmpInst *RHS = dyn_cast<ICmpInst>(SrcI->getOperand(1));
if (LHS && RHS && LHS->hasOneUse() && RHS->hasOneUse() &&
(transformZExtICmp(LHS, CI, false) ||
transformZExtICmp(RHS, CI, false))) {
Value *LCast = Builder->CreateZExt(LHS, CI.getType(), LHS->getName());
Value *RCast = Builder->CreateZExt(RHS, CI.getType(), RHS->getName());
return BinaryOperator::Create(Instruction::Or, LCast, RCast);
}
}
```
The first two lines do the actual `zext(icmp)` optimization. The remaining lines have been added by r4...
2016 Jul 27
2
Remove zext-unfolding from InstCombine
...Inst *RHS = dyn_cast<ICmpInst>(SrcI->getOperand(1));
> if (LHS && RHS && LHS->hasOneUse() && RHS->hasOneUse() &&
> (transformZExtICmp(LHS, CI, false) ||
> transformZExtICmp(RHS, CI, false))) {
> Value *LCast = Builder->CreateZExt(LHS, CI.getType(), LHS->getName());
> Value *RCast = Builder->CreateZExt(RHS, CI.getType(), RHS->getName());
> return BinaryOperator::Create(Instruction::Or, LCast, RCast);
> }
> }
> ```
>
> The first two lines do the actual `zext(icmp)` optimization. The re...
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
...ils/SimplifyLibCalls.cpp
===================================================================
--- lib/Transforms/Utils/SimplifyLibCalls.cpp (revision 260011)
+++ lib/Transforms/Utils/SimplifyLibCalls.cpp (working copy)
@@ -555,6 +555,49 @@
if (isOnlyUsedInZeroEqualityComparison(CI))
return B.CreateZExt(B.CreateLoad(Src, "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...
2016 Aug 04
2
Remove zext-unfolding from InstCombine
...<ICmpInst>(SrcI->getOperand(1));
> > if (LHS && RHS && LHS->hasOneUse() && RHS->hasOneUse() &&
> > (transformZExtICmp(LHS, CI, false) ||
> > transformZExtICmp(RHS, CI, false))) {
> > Value *LCast = Builder->CreateZExt(LHS, CI.getType(), LHS->getName());
> > Value *RCast = Builder->CreateZExt(RHS, CI.getType(), RHS->getName());
> > return BinaryOperator::Create(Instruction::Or, LCast, RCast);
> > }
> > }
> > ```
> >
> > The first two lines do the actual...
2007 Dec 17
0
[LLVMdev] Elsa and LLVM and LLVM submissions
...> =
> =
> =--------------------------------------------------------------------
> ===//
> +
> + Value *CreateTrunc(Value *V, const Type *DestTy, const char *Name
> = "") {
> + return CreateCast(Instruction::Trunc, V, DestTy, Name);
> + }
> + Value *CreateZExt(Value *V, const Type *DestTy, const char *Name
> = "") {
> + return CreateCast(Instruction::ZExt, V, DestTy, Name);
> + }
> + Value *CreateSExt(Value *V, const Type *DestTy, const char *Name
> = "") {
> + return CreateCast(Instruction::SExt, V, Dest...
2007 Dec 17
2
[LLVMdev] Elsa and LLVM and LLVM submissions
Devang Patel wrote:
> On Dec 15, 2007, at 12:15 PM, Richard Pennington wrote:
>
>> I got the current version of LLVM via svn yesterday and modified my
>> code to
>> use the LLVMFoldingBuilder. Very nice!
>>
>> My question is this: I noticed that the folding builder doesn't fold
>> some
>> operations, e.g. casts. Is there some reason why? If