[all-commits] [llvm/llvm-project] 92da5b: [InstCombine] Simplify phis with incoming pointer-...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Mar 9 03:40:52 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 92da5b711970610a2246cfa1baff5c2a63559e1b
      https://github.com/llvm/llvm-project/commit/92da5b711970610a2246cfa1baff5c2a63559e1b
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-03-09 (Tue, 09 Mar 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
    M llvm/test/Transforms/InstCombine/phi-pointercasts.ll

  Log Message:
  -----------
  [InstCombine] Simplify phis with incoming pointer-casts.

If the incoming values of a phi are pointer casts of the same original
value, replace the phi with a single cast. Such redundant phis are
somewhat common after loop-rotate and removing them can avoid some
unnecessary code bloat, e.g. because an iteration of a loop is peeled
off to make the phi invariant. It should also simplify further analysis
on its own.

InstCombine already uses stripPointerCasts in a couple of places and
also simplifies phis based on the incoming values, so the patch should
fit in the existing scope.

The patch causes binary changes in 47 out of 237 benchmarks in
MultiSource/SPEC2000/SPEC2006 with -O3 -flto on X86.

Reviewed By: lebedev.ri

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




More information about the All-commits mailing list