[all-commits] [llvm/llvm-project] 336d72: [InstCombine] Preserve inbounds when folding selec...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 7 01:01:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 336d7281ad61fbd4a14fa2ef3d2bde5a63d10417
      https://github.com/llvm/llvm-project/commit/336d7281ad61fbd4a14fa2ef3d2bde5a63d10417
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-07-07 (Fri, 07 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-gep.ll
    M llvm/test/Transforms/InstCombine/stpncpy-1.ll
    M llvm/test/Transforms/PhaseOrdering/gep-null-compare-in-loop.ll

  Log Message:
  -----------
  [InstCombine] Preserve inbounds when folding select of GEP

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 in some cases.

Differential Revision: https://reviews.llvm.org/D154055




More information about the All-commits mailing list