This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLT/SETGT
AbandonedPublic

Authored by nemanjai on Aug 11 2017, 6:58 AM.

Details

Summary

This patch adds the two setcc patterns for both zext and sext.
Doing so uncovered a bug in some of the initial implementation. Namely some code sequences for 32-bit comparisons actually require the upper 32 bits of the register to be correctly defined. We solved this by adding the correct extension when needed. However, the code still pretended that the intermediate values are i32. This generally worked just fine but fails to work correctly if a register is spilled somewhere within the sequence - after the spill/reload, the value in the register will always be zero-extended, so if it was sign-extended before the spill, we have a problem.

This patch adds the pattern and fixes the bug.

Diff Detail

Repository
rL LLVM

Event Timeline

nemanjai created this revision.Aug 11 2017, 6:58 AM
nemanjai abandoned this revision.Sep 22 2017, 9:46 PM

The SETLT/SETGT patterns were committed in rL314055.
The spill problem fix was committed in rL313978.

As per Eric's comment in D33718, no separate reviews for patches that only add individual patterns (as rL314055 does).