[all-commits] [llvm/llvm-project] ea817d: [SimplifyCFG] Look for control flow changes instea...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Mon May 3 13:32:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea817d79be2686d1d5fad04d429dbe392ee22b5f
      https://github.com/llvm/llvm-project/commit/ea817d79be2686d1d5fad04d429dbe392ee22b5f
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2021-05-03 (Mon, 03 May 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/while-loops.ll
    M llvm/test/Transforms/PhaseOrdering/d83507-knowledge-retention-bug.ll
    M llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll

  Log Message:
  -----------
  [SimplifyCFG] Look for control flow changes instead of side effects.

When passingValueIsAlwaysUndefined scans for an instruction between an
inst with a null or undef argument and its first use, it was checking
for instructions that may have side effects, which is a superset of the
instructions it intended to find (as per the comments, control flow
changing instructions that would prevent reaching the uses). Switch
to using isGuaranteedToTransferExecutionToSuccessor() instead.

Without this change, when enabling -fwhole-program-vtables, which causes
assumes to be inserted by clang, we can get different simplification
decisions. In particular, when building with instrumentation FDO it can
affect the optimizations decisions before FDO matching, leading to some
mismatches.

I had to modify d83507-knowledge-retention-bug.ll since this fix enables
more aggressive optimization of that code such that it no longer tested
the original bug it was meant to test. I removed the undef which still
provokes the original failure (confirmed by temporarily reverting the
fix) and also changed it to just invoke the passes of interest to narrow
the testing.

Similarly I needed to adjust code for UnreachableEliminate.ll to avoid
an undef which was causing the function body to get optimized away with
this fix.

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




More information about the All-commits mailing list