[all-commits] [llvm/llvm-project] a8ab1f: [Evaluator] Look through invariant.group intrinsics

aeubanks via All-commits all-commits at lists.llvm.org
Mon Apr 12 16:12:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8ab1f98d22cf15f39dd1c2ce77675e628fceb31
      https://github.com/llvm/llvm-project/commit/a8ab1f98d22cf15f39dd1c2ce77675e628fceb31
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2021-04-12 (Mon, 12 Apr 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Evaluator.h
    M llvm/lib/Transforms/Utils/Evaluator.cpp
    M llvm/test/Transforms/GlobalOpt/invariant.group.ll

  Log Message:
  -----------
  [Evaluator] Look through invariant.group intrinsics

Turning on -fstrict-vtable-pointers in Chrome caused an extra global
initializer. Turns out that a llvm.strip.invariant.group intrinsic was
causing GlobalOpt to fail to step through some simple code.

We can treat *.invariant.group uses as simply their operand.
Value::stripPointerCastsForAliasAnalysis() does exactly this. This
should be safe because the Evaluator does not skip memory accesses due
to invariants or alias analysis.

However, we don't want to leak that we've stripped arbitrary pointer
casts to users of Evaluator, so we bail out if we evaluate a function to
any constant, since we may have looked through *.invariant.group calls
and aliasing pointers cannot be arbitrarily substituted.

Reviewed By: rnk

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




More information about the All-commits mailing list