This is an archive of the discontinued LLVM Phabricator instance.

[DemandedBits][BDCE] Add support for min/max intrinsics
ClosedPublic

Authored by nikic on Sep 4 2020, 1:45 PM.

Details

Summary

Add DemandedBits / BDCE support for min/max intrinsics: If the low bits are not demanded in the result, they also aren't demanded in the operands.

We'll want the same in InstCombineSimplifyDemanded, but we need KnownBits support to land first, so that's waiting on D87034.

Diff Detail

Event Timeline

nikic created this revision.Sep 4 2020, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2020, 1:45 PM
nikic requested review of this revision.Sep 4 2020, 1:45 PM
spatel accepted this revision.Sep 10 2020, 9:03 AM

LGTM

llvm/lib/Analysis/DemandedBits.cpp
181–183

Nit: this is where LLVM formatting rules break down. I couldn't tell that we were in a switch-within-an-if-within-a-swich from that single brace/indent. At the least, I'd add braces on the 'if'.

This revision is now accepted and ready to land.Sep 10 2020, 9:03 AM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.Sep 10 2020, 1:14 PM
nikic added inline comments.
llvm/lib/Analysis/DemandedBits.cpp
181–183

Agreed. I've added braces for the if in a separate commit: https://github.com/llvm/llvm-project/commit/99e78cb7185db1a15afd33020a1e026dc7ac5e1b