Displaying 20 results from an estimated 63 matches for "createadd".
2019 Jul 03
3
optimisation issue in an llvm IR pass
...3, 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, 1));
AddOv->setMetadata(M.getM...
2019 Jul 03
2
optimisation issue in an llvm IR pass
...eded
add cl,0x1 // <- should be done to dl instead
adc dl,0x1
mov BYTE PTR [rsi+rdi*1],dl
Far below are both variants with the full code around it, however the
difference in both variants is this:
//variant1
auto cf = IRB.CreateICmpEQ(Incr, ConstantInt::get(Int8Ty, 0));
Incr = IRB.CreateAdd(Incr, cf);
//variant2
auto cf = IRB.CreateICmpULT(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, Cons...
2016 Mar 16
3
IRBuilder Assignment ( '=' ) operator?
...-dev at lists.llvm.org
Subject: Re: [llvm-dev] IRBuilder Assignment ( '=' ) operator?
Hi Paul,
On 15 March 2016 at 17:59, Paul Hancock via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> In my code assembly system I have the various LH-RH operators, ADD, ADDF,
> SUB, etc, using CreateAdd, CreateFAdd, etc, however I cant seem to locate
> the correct function/s for the assignment operator.
The assignment is automatic. The pointer you get back from CreateAdd
can be used directly in other instructions. When this is transcribed
to the textual IR, LLVM will put in the appropriate ass...
2016 Mar 16
2
IRBuilder Assignment ( '=' ) operator?
In my code assembly system I have the various LH-RH operators, ADD, ADDF, SUB, etc, using CreateAdd, CreateFAdd, etc, however I cant seem to locate the correct function/s for the assignment operator.
What's the correct function/s in the IRBuilder for assigning a value?
- Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/l...
2016 Mar 16
3
IRBuilder Assignment ( '=' ) operator?
...man <Jeremy.Lakeman at gmail.com>
Sent: 16 March 2016 14:24
To: Paul Hancock
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] IRBuilder Assignment ( '=' ) operator?
There is a store operation if you want the value on the stack or heap, but there is no assignment operator in IR.
CreateAdd returns an Instruction which represents both the operation and the result value. Value's are immutable and can be used as input arguments to any Instruction further down the control flow.
The other thing you might need to research is the Phi Instruction. Which gives you a way to specify how th...
2011 Jul 31
2
[LLVMdev] "Cannot select" error in 2.9
...ttp://llvm.org/releases/2.6/docs/ReleaseNotes.html#coreimprovements>.
>
> Interesting -- then I guess my question is why 2.8 (which is the first version of LLVM I've used) didn't flag this?
>
> Either way, it makes sense and changing my API usage to call CreateFAdd instead of CreateAdd fixes this.
For a while, we kept some API backwards compatibility magic in place
which would forward creations of adds into creations of fadds.
Nick
2005 Jan 27
1
[LLVMdev] Question about inserting IR code
Hi,
From the file HowToUseJIT.cpp, I learned how to insert some calcuation IR code like Add/Sub/Mul etc by using
Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB);
By following this way, it works well when I insert some IR code whose operand is integer type like IntTy, however, when I tried to insert similar thing whose operands are float point, I got the following message when I run it
void llvm::BinaryOperator::init(...
2018 Aug 07
2
Create an Add Instruction in LLVM IR
...re is part
of the runOnFunction() method of my function pass:
...
LLVMContext &Context = F.getContext();
IRBuilder<> builder(&Instruction);
Value *Lef = ConstantInt::get(Type::getInt32Ty(Context), 4);
Value *Rig = ConstantInt::get(Type::getInt32Ty(Context), 5);
Value *Result = builder.CreateAdd(Lef, Rig);
...
It seems that the problem is with the ConstantInt::get() function. Any idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180807/3565bd7b/attachment.html>
2013 Jan 01
2
[LLVMdev] clang with -emit-llvm
...t started using llvm. I was trying to debug how *clang* generates
IR for very simple C testcases (few assignments and if-condsitions).
To get a hold on the basic functions, I put some break points on following
functions but debugger *didn't stop*:
llvm::BasicBlock::Create
llvm::BinaryOperator::CreateAdd (design has binary op)
llvm::Value::Value
llvm::BranchInst::Create (design has if/else)
...
and quite a few
The command line I used :
*clang -S test.c -emit-llvm -o - *
Here I could see the entire LLVM code generated and shown in stdout. I am
almost sure that I have missed something very basic....
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...ionVisitor::incrementGlobalKey(Instruction* I) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey");
if (key) {
LoadInst* load = Builder.CreateLoad(key);
Value* inc = Builder.CreateAdd(load, Builder.getInt64(1));
StoreInst* store = Builder.CreateStore(inc, key);
return store;
}
return I;
}
Instruction* InstructionVisitor::print(Instruction* I, const char* text,
Value* arg1, Value* arg2, Value* arg3, Value* arg4) {
Function* printfFn = I->getModule()->getFunction("prin...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...ctionVisitor I try to update it like that:
IRBuilder<> Builder(I->getContext());Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey");
if (key) {
LoadInst* load = Builder.CreateLoad(key);
Value* inc = Builder.CreateAdd(load, Builder.getInt64(1));
StoreInst* store = Builder.CreateStore(inc, key);}
I print that global variable during execution of instrumented code. I
access it's value by key->getOperand(0), but it's unchanged. I'm using ORC
JIT based on this tutorial:
https://llvm.org/docs/tutor...
2014 Jun 25
2
[LLVMdev] Question Regarding Sign-Overflow
...rty/llvm/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:48251%257Cdef&l=1471&gsn=Res> = BinaryOperator <https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/include/llvm/IR/InstrTypes.h&ct=xref_jump_to_def&cl=GROK&l=138&gsn=BinaryOperator>::CreateAdd(Op0 <https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp&ct=xref_jump_to_def&cl=GROK&l=1456&gsn=Op0>, V <https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/lib/Transforms/InstCombine/I...
2010 Jun 21
1
[LLVMdev] [PATCH] docs/tutorial/ Kaleidoscope typos
On Mon, 21 Jun 2010 15:31:57 -0500, Chris Lattner <clattner at apple.com>
wrote:
> Applied in r106468, thanks!
>
> -Chris
I think there's a few bugs left in the Kaleidoscope tutorial -- I noticed
somebody converted some of the "Builder.CreateAdd" to CreateFAdd, etc., but
there seem to be a few that got missed. Attached diff is what I could
find...
Kevin Kelley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Kaleidoscope-fadd.diff
Type: application/octet-stream
Size: 2266 bytes
Desc: not availab...
2011 Jul 30
2
[LLVMdev] "Cannot select" error in 2.9
On 30 July 2011 23:39, Gregory Junker <gjunker at dayark.com> wrote:
>> From: Nick Lewycky [mailto:nicholas at mxc.ca]
[snip]
>> Gregory Junker wrote:
>> > That doesn't make a lot of sense to me -- LLVM can't add doubles?
>>
>> No, LLVM can't, but it can fadd them. ;) "add" only accepts integers
>> and
>> vectors of integers,
2011 Jul 30
0
[LLVMdev] "Cannot select" error in 2.9
...here:
> <http://llvm.org/releases/2.6/docs/ReleaseNotes.html#coreimprovements>.
Interesting -- then I guess my question is why 2.8 (which is the first version of LLVM I've used) didn't flag this?
Either way, it makes sense and changing my API usage to call CreateFAdd instead of CreateAdd fixes this.
Thanks
Greg
2011 Jul 31
0
[LLVMdev] "Cannot select" error in 2.9
...cs/ReleaseNotes.html#coreimprovements>.
> >
> > Interesting -- then I guess my question is why 2.8 (which is the
> first version of LLVM I've used) didn't flag this?
> >
> > Either way, it makes sense and changing my API usage to call
> CreateFAdd instead of CreateAdd fixes this.
>
> For a while, we kept some API backwards compatibility magic in place
> which would forward creations of adds into creations of fadds.
>
> Nick
Figured it might be something like that. ;)
Thanks again!
Greg
2012 Jul 04
1
[LLVMdev] Non-tail calls
On Wed, Jul 04, 2012 at 11:31:57AM +0100, Joey wrote:
> Sounds like you are using the C++ API.
>
> You can store the value like:
> Value *val = Builder.CreateCall(...);
>
> Then, for example, you can do:
> Builder.CreateAdd(val, val);
That looks a lot like what I am trying to do. I will assume that my problem is either caused by my environment (VC7.1) or by the fact that I am using an older version of llvm (2.5). Will upgrade my llvm and report back if my problem persists.
Adelle.
2016 May 31
0
AMDGPUPromoteAlloca assume 3-dims enabled?
...lue *TIdY = getWorkitemID(Builder, 1);
Value *TIdZ = getWorkitemID(Builder, 2);
Value *Tmp0 = Builder.CreateMul(TCntY, TCntZ, "", true, true);
Tmp0 = Builder.CreateMul(Tmp0, TIdX);
Value *Tmp1 = Builder.CreateMul(TIdY, TCntZ, "", true, true);
Value *TID = Builder.CreateAdd(Tmp0, Tmp1);
TID = Builder.CreateAdd(TID, TIdZ);
it assumes that we enable 3 dims already?
actually, it's not the case for SI. SI only enable dim-x
for non-shader programs by default(SIMachinefunctionInfo.cpp) . does
it conflict?
thanks,
--lx
-------------- next part --------------
A...
2007 May 27
2
[LLVMdev] New LLVMBuilder api
...with Alloca, for example).
2. The instruction ctors all default construct an std::string. In
practice, this is a very modest overhead, but if it isn't needed, it
shouldn't happen.
3. Some of the construction APIs are very verbose, my "favorite" being
BinaryOperator::createAdd and friends.
The new API separates the idea of what to construct from where to insert
it. In particular, when you create an LLVMBuilder object, you can tell it
where to insert all subsequently created instructions. This means you end
up writing code like this:
LLVMBuilder B;
B.SetInsertPoint...
2011 Jan 21
0
[LLVMdev] How to change the type of an Instruction?
...nge the type of an integer variable. For instance,
> given the instruction "%3 = add i32 %1, %2" I would like to alter the
> instruction to "%3 = add i16 %1, %2". Is there any way to do this?
>
No. Instead you create a new Instruction, in this case with
BinaryOperator::CreateAdd, then OldInst->replaceAllUsesWith(NewInst) to
update all the users, then OldInst->eraseFromParent() since it's now dead
code.
Also, all values have types immutably assigned at creation, so you'll need
to insert casts (trunc instructions in your case) to cast %1 and %2 from i32
to i16...