This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Preserve inbounds when folding select of GEP
ClosedPublic

Authored by nikic on Jun 29 2023, 2:05 AM.

Details

Summary

The select base, (gep base, offset) to gep base, select (0, offset) fold used to drop inbounds, because the gep base, 0 this introduces might not be inbounds. After the semantics change in D154051, such a GEP is always considered inbounds, in which allows us to preserve the flag here.

As the PhaseOrdering test demonstrates, this can result in major optimization improvements.

Depends on: D154051

Diff Detail