This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Avoid VSX FMA mutate when killed product reg = addend reg
ClosedPublic

Authored by wschmidt on Oct 20 2014, 4:31 PM.

Details

Reviewers
hfinkel
Summary

With VSX enabled, test/CodeGen/PowerPC/recipest.ll exposes a bug in the FMA mutation pass. If we have a situation where a killed product register is the same register as the FMA target, such as:

%vreg5<def,tied1> = XSNMSUBADP %vreg5<tied0>, %vreg11, %vreg5,
                                %RM<imp-use>; VSFRC:%vreg5 F8RC:%vreg11

then the substitution makes no sense. We end up getting a crash when we try to extend the interval associated with the killed product register, as there is already a live range for %vreg5 there. This patch just disables the mutation under those circumstances.

Since recipest.ll generates different code with VMX enabled, I've modified that test to use -mattr=-vsx. I've borrowed the code from that test that exposed the bug and placed it in fma-mutate.ll, where it tests several mutation opportunities, including the "bad" one.

Diff Detail

Event Timeline

wschmidt updated this revision to Diff 15158.Oct 20 2014, 4:31 PM
wschmidt retitled this revision from to [PowerPC] Avoid VSX FMA mutate when killed product reg = addend reg.
wschmidt updated this object.
wschmidt edited the test plan for this revision. (Show Details)
wschmidt added a reviewer: hfinkel.
wschmidt added subscribers: wschmidt, hfinkel.
wschmidt added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Oct 20 2014, 9:29 PM
hfinkel edited edge metadata.

Oops. LGTM, thanks!

This revision is now accepted and ready to land.Oct 20 2014, 9:29 PM
wschmidt closed this revision.Oct 21 2014, 6:14 AM

r220290. Thanks for the quick review!