This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] enhance vector demanded elements for select condition operand
AbandonedPublic

Authored by spatel on May 27 2020, 12:44 PM.

Details

Summary

This is part of reducing IR in PR42755:
https://bugs.llvm.org/show_bug.cgi?id=42755

If we can determine that both arms of a given element of a vector select are the same value, then the select's condition operand is not demanded at that element.

Alive2 examples based on the regression tests:
http://volta.cs.utah.edu:8080/z/2PCSs2
http://volta.cs.utah.edu:8080/z/s4hWra
http://volta.cs.utah.edu:8080/z/Jgexop

Diff Detail

Event Timeline

spatel created this revision.May 27 2020, 12:44 PM

I'm concerned that in some cases, the condition might be "demanded" due to poison rules, even if we don't actually care about the value. See, for example, http://volta.cs.utah.edu:8080/z/YDSX7k

spatel planned changes to this revision.May 27 2020, 4:23 PM

I'm concerned that in some cases, the condition might be "demanded" due to poison rules, even if we don't actually care about the value. See, for example, http://volta.cs.utah.edu:8080/z/YDSX7k

Yes, I overlooked poison in the condition operand itself. Given that, I don't see a way to salvage this approach vs. a pattern-specific fold for the motivating case (reducing a shuffle of the condition operand).
I'll leave this up for a bit in case anyone else sees a way forward.

spatel abandoned this revision.Jun 1 2020, 9:14 AM

Another test added with:
rGb874dc4ddabe

Abandoning.