similar to: failing to optimize boolean ops on cmps

Displaying 20 results from an estimated 200 matches similar to: "failing to optimize boolean ops on cmps"

2017 Jul 13
2
failing to optimize boolean ops on cmps
This can't be an instsimplify though? The values we want in these cases do not exist already: %res = or i8 %b, %a %res = or i1 %cmp, %c On Thu, Jul 13, 2017 at 5:10 PM, Daniel Berlin <dberlin at dberlin.org> wrote: > > > On Thu, Jul 13, 2017 at 2:12 PM, Sanjay Patel <spatel at rotateright.com> > wrote: > >> We have several optimizations in InstCombine
2017 Jul 14
2
failing to optimize boolean ops on cmps
On 07/13/2017 06:40 PM, Daniel Berlin via llvm-dev wrote: > Ah yes, it can only return one instruction and you need two. > > NewGVN could still handle it if instsimplify was changed to return the > right binary operators because it has infrastructure that can handle > insertion. > (it would need a little work). > > > (At this point, InstCombine seems to have become
2008 Nov 09
2
[LLVMdev] m_Not Pattern Question
I have a question about the pattern matching stuff that's used in the Instruction Combiner. If I have code like this: if (match(B, m_Select(m_Value(), m_ConstantInt(0), m_ConstantInt(-1)))) { if (match(C, m_Not(m_Value(B)))) return SelectInst::Create(cast<User>(B)->getOperand(0), D, A); and we match, the program fails during the
2018 Dec 18
2
should we do this time-consuming transform in InstCombine?
Hi, There is an opportunity in instCombine for following instruction pattern: %mul = mul nsw i32 %b, %a %cmp = icmp sgt i32 %mul, -1 %sub = sub i32 0, %a %mul2 = mul nsw i32 %sub, %b %cond = select i1 %cmp, i32 %mul, i32 %mul2 Source code for above pattern: return (a*b) >=0 ? (a*b) : -a*b; Currently, llvm(-O3) can not recognize this as abs(a*b). I initially think we could do this in
2008 May 17
2
[LLVMdev] More info, was Help needed after hiatus
Hi, I know my last question was very vague (i.e. "It stopped working, what went wrong?"), so here is a little more concrete example: If I run the optimizer (opt) on this code snippet with -std-compile-opts the optimizer hangs. ; ModuleID = 'test.ubc' target datalayout =
2018 Dec 18
2
should we do this time-consuming transform in InstCombine?
Hi Roman, Thanks for your good idea. I think it can solve the abs issue very well. I can continue with my work now^-^. But if it is not abs and there is no select, %res = OP i32 %b, %a %sub = sub i32 0, %b %res2 = OP i32 %sub, %a theoretically, we can still do the following transform for the above pattern: %res2 = OP i32 %sub, %a ==> %res2 = sub i32 0, %res Not sure whether we can do it
2017 Jul 15
2
failing to optimize boolean ops on cmps
On 07/14/2017 11:46 AM, Hal Finkel via llvm-dev wrote: > > > On 07/14/2017 01:38 PM, Daniel Berlin wrote: >> >> >> Not sure about this last part. It is really going to require work >> by us to rewrite things. :-) In the mean time, I think we should >> go ahead with this. >> >> >> FWIW: My problem is, when put in this framework,
2019 Dec 31
3
Any significance for m_OneUse in (X / Y) / Z => X / (Y * Z) ??
Dear All, The InstCombine pass performs the following transformation. Z / (X / Y) => (Y * Z) / X This is performed only when operand Op1 ( (X/Y) in this case) has only one use in future. The code snippet is shown below. if (match(Op1, m_OneUse(m_FDiv(m_Value(X), m_Value(Y)))) && (!isa<Constant>(Y) || !isa<Constant>(Op0))) { // Z / (X / Y) => (Y *
2017 Jul 14
2
failing to optimize boolean ops on cmps
Going back to the original problem. Why shouldn't SimplifyUsingDistributiveLaws handle both these cases? For the bitwise test case if you distribute you get (~A | A) & (B | A) The left side of that simplifies to all 1s which is the identify value for and. So even though the right side doesn't simplify it's a win. ~Craig On Fri, Jul 14, 2017 at 11:46 AM, Hal Finkel via llvm-dev
2017 Jul 14
2
failing to optimize boolean ops on cmps
On 07/14/2017 10:27 AM, Daniel Berlin wrote: > > > On Thu, Jul 13, 2017 at 6:18 PM, Hal Finkel <hfinkel at anl.gov > <mailto:hfinkel at anl.gov>> wrote: > > > On 07/13/2017 06:40 PM, Daniel Berlin via llvm-dev wrote: >> Ah yes, it can only return one instruction and you need two. >> >> NewGVN could still handle it if instsimplify was
2008 May 17
0
[LLVMdev] More info, was Help needed after hiatus
On Sat, May 17, 2008 at 11:34 AM, Richard Pennington <rich at pennware.com> wrote: > If I run the optimizer (opt) on this code snippet with -std-compile-opts > the optimizer hangs. > > > ; ModuleID = 'test.ubc' > target datalayout = >
2017 Jul 14
5
failing to optimize boolean ops on cmps
> > > Not sure about this last part. It is really going to require work by us to > rewrite things. :-) In the mean time, I think we should go ahead with this. > FWIW: My problem is, when put in this framework, we will repeatedly make this same decision, this same way, again and again, and never actually get even started on fixing it :) IE "it's just another small
2017 Jul 14
3
failing to optimize boolean ops on cmps
On Fri, Jul 14, 2017 at 10:54 AM, Daniel Berlin <dberlin at dberlin.org> wrote: > > >> I think you're done when you get everything that you have that fits into >> a model of local transformations and that should be run to a fixed point. >> > > Sure, but to point out what you certainly already know, that's almost > every optimization you can think of
2020 Jan 03
3
Any significance for m_OneUse in (X / Y) / Z => X / (Y * Z) ??
A couple more general comments: 1. There shouldn't be any correctness issues removing one-use checks (the transform should be safe independently of use-counts). 2. Ideally, you can remove a m_OneUse() from the code and run 'make check' or similar, and you will see a regression test failure because we have a 'negative' test to cover that pattern. That should make it clear that
2012 Oct 30
2
[LLVMdev] Any plan to add MIN/MAX isd node?
Hi Duncan, To use select, usually, there is a compare before select. Presence of comparison will disable some opportunities to optimize some code. Select and Compare is not associative neither. Thanks, Yin -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands Sent: Tuesday, October 30, 2012
2020 Jan 06
2
Any significance for m_OneUse in (X / Y) / Z => X / (Y * Z) ??
Is your case the case mentioned in the subject or a different case? ~Craig On Sun, Jan 5, 2020 at 8:11 PM raghesh <raghesh.a at gmail.com> wrote: > Thanks Sanjay for your comments. > > So, if we want to add a transformation avoiding the one-use check, which > one is the ideal pass? Shall we do it in -aggressive-instcombine? I came > to know that if the pattern search
2012 Oct 30
0
[LLVMdev] Any plan to add MIN/MAX isd node?
Hi Yin, > To use select, usually, there is a compare before select. > Presence of comparison will disable some opportunities to > optimize some code. Select and Compare is not associative > neither. at the IR level LLVM already has pattern matching helpers for identifying min/max idioms, here is part of a transform using this, from InstructionSimplify.cpp: // Signed variants
2012 Oct 30
1
[LLVMdev] Any plan to add MIN/MAX isd node?
Hi Duncan, Yes, exactly. However, we need define Opcode MIN/MAX Into ISDOpcodes.h. Do you like to add those two definitions Into the tree? Thanks, Yin -----Original Message----- From: Duncan Sands [mailto:duncan.sands at gmail.com] On Behalf Of Duncan Sands Sent: Tuesday, October 30, 2012 12:10 PM To: Yin Ma Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Any plan to
2005 Oct 05
1
[LLVMdev] Cast instructions
The following situation comes up a lot in what I'm doing. I want to check if a value is a certain kind of instruction. The test also needs to succeed if the value is a *cast* of the instruction (or a cast of a cast, etc.) I.e., I need to "see through" any intervening casts to get to the "real" value. It's trivial to write a function that does this, but does
2014 Jul 01
2
[LLVMdev] Probable error in InstCombine
I've found what appears to be a bug in instcombine. Specifically, the transformation of -(X/C) to X/(-C) is invalid if C == INT_MIN. Specifically, if I have > define i32 @foo(i32 %x) #0 { > entry: > %div = sdiv i32 %x, -2147483648 > %sub = sub nsw i32 0, %div > ret i32 %sub > } then opt -instcombine will produce > define i32 @foo(i32 %x) #0 { > entry: > %sub