search for: constantfoldbinaryinstruction

Displaying 11 results from an estimated 11 matches for "constantfoldbinaryinstruction".

2010 Jul 07
2
[LLVMdev] ConstantFold 'undef xor undef'
On Tue, Jul 6, 2010 at 8:34 PM, Chris Lattner <clattner at apple.com> wrote: > > On Jul 6, 2010, at 3:37 PM, Jianzhou Zhao wrote: > >> Which semantics is better? I guess both are fine because if we assume >> these two def's are same, then it is 0 as >> 'ConstantFoldBinaryInstruction', while if we assume they are different >> then it is equal to undef. But the second case seems to include the >> first one. If we let undef xor undef to be undef, later we can use >> this undef as 0, but also other values w.r.t contexts. Is there any >> reason that Cons...
2010 Jul 07
2
[LLVMdev] ConstantFold 'undef xor undef'
On Jul 7, 2010, at 5:47 AM, Jianzhou Zhao wrote: >> >> Does this also apply to two different variables? say >> int z x y; >> z = x ^ y; >> If ConstantFoldBinaryInstruction also folds x ^ y into z, should this >> pass (which uses ConstantFold) also initialize x and y with a same >> initial value? Otherwise at runtime z may not be 0. > > I guess my question is what variables can have undef values. In my > understanding, only uninitialized locals a...
2010 Jul 06
2
[LLVMdev] ConstantFold 'undef xor undef'
Hi, At line 2292, lib/VMCore/ConstantFold.cpp (llvm2.7 release) Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1, Constant *C2) { ... // Handle UndefValue up front. if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { switch (Opcode) { case Instruction::Xor: if (isa<UndefValue>(C1) && isa<...
2010 Jul 07
0
[LLVMdev] ConstantFold 'undef xor undef'
...at 8:34 PM, Chris Lattner <clattner at apple.com> wrote: >> >> On Jul 6, 2010, at 3:37 PM, Jianzhou Zhao wrote: >> >>> Which semantics is better? I guess both are fine because if we assume >>> these two def's are same, then it is 0 as >>> 'ConstantFoldBinaryInstruction', while if we assume they are different >>> then it is equal to undef. But the second case seems to include the >>> first one. If we let undef xor undef to be undef, later we can use >>> this undef as 0, but also other values w.r.t contexts. Is there any >>>...
2010 Jul 07
0
[LLVMdev] ConstantFold 'undef xor undef'
On Jul 6, 2010, at 3:37 PM, Jianzhou Zhao wrote: > Which semantics is better? I guess both are fine because if we assume > these two def's are same, then it is 0 as > 'ConstantFoldBinaryInstruction', while if we assume they are different > then it is equal to undef. But the second case seems to include the > first one. If we let undef xor undef to be undef, later we can use > this undef as 0, but also other values w.r.t contexts. Is there any > reason that ConstantFoldBinaryIn...
2010 Jul 07
0
[LLVMdev] ConstantFold 'undef xor undef'
On Wed, Jul 7, 2010 at 11:38 AM, Chris Lattner <clattner at apple.com> wrote: > > On Jul 7, 2010, at 5:47 AM, Jianzhou Zhao wrote: > >>> >>> Does this also apply to two different variables? say >>>   int z x y; >>>   z = x ^ y; >>> If ConstantFoldBinaryInstruction also folds x ^ y into z, should this >>> pass (which uses ConstantFold) also initialize x and y with a same >>> initial value? Otherwise at runtime z may not be 0. >> >> I guess my question is what variables can have undef values. In my >> understanding, only uni...
2014 Sep 19
2
[LLVMdev] More careful treatment of floating point exceptions
Hi Sanjay, Thanks, I saw this flag and it's definitely should be considered, but it appeared to me to be static characteristic of target platform. I'm not sure how appropriate it would be to change its value from a front-end. It says "Has", while optional flag would rather say "Uses" meaning that implementation cares about floating point exceptions. Regards, Sergey
2014 Sep 25
2
[LLVMdev] More careful treatment of floating point exceptions
..., but calculations like x / 3 are safe. diff --git a/lib/IR/ConstantFold.cpp b/lib/IR/ConstantFold.cpp index b96d154..18820a5 100644 --- a/lib/IR/ConstantFold.cpp +++ b/lib/IR/ConstantFold.cpp @@ -886,7 +886,8 @@ Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg, Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, - Constant *C1, Constant *C2) { + Constant *C1, Constant *C2, + bool HonorFPExceptions) { // Handle UndefValue up front. if (isa<UndefValu...
2015 Sep 14
2
[LLVMDev] Inconsistent result between GCC and Clang for __builtin_fmodf
...gpoint_clang builtin_fmodf_bugpoint.cpp 1.000000 fmodf 0.100000 = 0.000000 Clang will compile __builtin_fmod() into LLVM's "frem" [1]. Since both operands are constant, it is constant folded by IRBuilder at the time when "frem" was built. The exeuction finally goes to llvm::ConstantFoldBinaryInstruction() which uses APFloat::mod() to compute the result. As you can see from above, it gives us 0.000000 (hex: 0x0) which is different than the answer from std::fmodf() (0.100000, hex: 0x3dcccccb). SelectionDAG also uses APFloat::mod() to fold "frem" when operands are constants. (see Selection...
2010 Mar 23
2
[LLVMdev] How to avoid memory leaks
...st*, char const&, std::_Rb_tree_iterator<std::pair<std::pair<llvm::Type const*, char> const, llvm::UndefValue*> >) (in /home/gabi/vgen/Debug/vgen) ==20504==    by 0x8853A3: llvm::UndefValue::get(llvm::Type const*) (in /home/gabi/vgen/Debug/vgen) ==20504==    by 0x927DBA: llvm::ConstantFoldBinaryInstruction(unsigned int, llvm::Constant*, llvm::Constant*) (in /home/gabi/vgen/Debug/vgen) ==20504==    by 0x88BD87: llvm::ConstantExpr::getTy(llvm::Type const*, unsigned int, llvm::Constant*, llvm::Constant*, unsigned int) (in /home/gabi/vgen/Debug/vgen) ==20504==    by 0x423B2E: llvm::ConstantFolder::Create...
2010 Mar 23
3
[LLVMdev] How to avoid memory leaks
...(vg_replace_malloc.c:220) ==17474== by 0x90A922: llvm::User::operator new(unsigned long, unsigned int) (in /home/gabi/vgen/Debug/vgen) ==17474== by 0x88A5B6: llvm::ConstantFP::get(llvm::LLVMContext&, llvm::APFloat const&) (in /home/gabi/vgen/Debug/vgen) ==17474== by 0x925E17: llvm::ConstantFoldBinaryInstruction(unsigned int, llvm::Constant*, llvm::Constant*) (in /home/gabi/vgen/Debug/vgen) ==17474== by 0x889587: llvm::ConstantExpr::getTy(llvm::Type const*, unsigned int, llvm::Constant*, llvm::Constant*, unsigned int) (in /home/gabi/vgen/Debug/vgen) ==17474== by 0x423030: llvm::ConstantFolder::Create...