[PATCH] D76638: [SDAG] fix crash in getNegatedExpression() by ignoring transient fadd

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 14:39:10 PDT 2020


spatel added a comment.

In D76638#1957541 <https://reviews.llvm.org/D76638#1957541>, @steven.zhang wrote:

> In D76638#1956952 <https://reviews.llvm.org/D76638#1956952>, @spatel wrote:
>
> > Ping. I think this change is useful regardless of whether/how we make a larger fix for getNegatibleCost+getNegatedExpression.
>
>
> I have posted a patch(https://reviews.llvm.org/D77319) to remove the getNegatibleCost. It is almost ready now. I am not sure if it is the best way , and welcome for the comments in advance. Regarding to the opportunities for this patch, can you double confirm it together with my patch to see if there is any improvement ?


Thanks for improving it!
I'm seeing something interesting with that patch applied for the test that is currently crashing - we re-use a common term in the equation, so that eliminates an instruction. For PPC, it looks like this:

  xssubsp f0, f1, f2
  xsmulsp f2, f0, f3
  xssubsp f0, f3, f0
  xsresp f4, f2
  xsmulsp f1, f0, f4
  xsnmsubasp f0, f2, f1
  xsmaddasp f1, f4, f0

But this seems to just be a lucky case because the other test (which is the same math except the fdiv operands are reversed) is not affected:

  xssubsp f0, f1, f2
  xssubsp f1, f2, f1
  xsmulsp f0, f0, f3
  xsaddsp f3, f1, f3
  xsresp f2,f 0
  xsmulsp f1, f3, f2
  xsnmsubasp f3, f0, f1
  xsmaddasp f1, f2, f3


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76638/new/

https://reviews.llvm.org/D76638





More information about the llvm-commits mailing list