[llvm-commits] [PATCH] GVN patch for overflow intrinsics

Owen Anderson resistor at mac.com
Thu Jul 7 10:19:32 PDT 2011


On Jul 7, 2011, at 9:20 AM, Chris Lattner wrote:
> I think that Owen is the best one to handle this.  In addition to handling the signed versions of these as well, does this correctly handle the case when the subtract comes first, and the cases when the overflow bit is actually used?

I don't see any issues with the use/non-use of the overflow bit.  For the signed overflow versions, is it only the semantics of the overflow bit that are affected?  Is the value part of the result the same between sadd/uadd?

> In principle, we'd want to optimize:
> 
> a = add i32 y, z
> ...
> b,c = addo(y,z)
> 
> into:
> 
> b,c = addo(y,z)
> a = b
>
I don't think this patch will currently do this.  What it will achieve is replacing all uses of b with uses of a, in your example.  Fusing the add and the addo together would a good thing to handle, but it's not a very GVN-ish operation.  It's mostly in the business of eliminating expressions, not mutating or injecting them.

All that said, this patch is definitely an improvement over what we did before, and the code looks fine to me.  Please document these future improvements in the PR, and go ahead and commit!

--Owen



More information about the llvm-commits mailing list