[all-commits] [llvm/llvm-project] 835951: [CodeExtractor] Remove stale llvm.assume calls fro...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Tue Jan 28 17:18:09 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8359511c62b727e360f93d9f5dab5893548227c8
      https://github.com/llvm/llvm-project/commit/8359511c62b727e360f93d9f5dab5893548227c8
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-01-28 (Tue, 28 Jan 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/CodeExtractor.h
    M llvm/lib/Transforms/Utils/CodeExtractor.cpp
    M llvm/test/Transforms/CodeExtractor/extract-assume.ll
    M llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
    A llvm/test/Transforms/HotColdSplit/stale-assume-in-original-func.ll
    M llvm/unittests/Transforms/Utils/CodeExtractorTest.cpp

  Log Message:
  -----------
  [CodeExtractor] Remove stale llvm.assume calls from extracted region

During extraction, stale llvm.assume handles may be retained in the
original function. The setup is:

1) CodeExtractor unregisters assumptions in the blocks that are to be
   extracted.

2) Extraction happens. There are now two functions: f1 and f1.extracted.

3) Leftover assumptions in f1 (/not/ removed as they were not in the set of
   blocks to be extracted) now have affected-value llvm.assume handles in
   f1.extracted.

When assumptions for a value used in f1 are looked up, ValueTracking can assert
as some of the handles are in the wrong function. To fix this, simply erase the
llvm.assume calls in the extracted function.

Alternatives include flushing the assumption cache in the original function, or
walking all values used in the original function to prune stale affected-value
handles. Both seem more expensive.

Testing: check-llvm, LNT run with -mllvm -hot-cold-split enabled

rdar://58460728




More information about the All-commits mailing list