[all-commits] [llvm/llvm-project] 91c9de: [CodeGenPrepare] Eliminate llvm.expect before remo...

Jann via All-commits all-commits at lists.llvm.org
Thu Mar 4 05:48:51 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 91c9dee3fb6d89ab3315fac1c1419614d6874b99
      https://github.com/llvm/llvm-project/commit/91c9dee3fb6d89ab3315fac1c1419614d6874b99
  Author: Jann Horn <jannh at google.com>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/test/Transforms/CodeGenPrepare/X86/delete-assume-dead-code.ll
    A llvm/test/Transforms/CodeGenPrepare/remove-assume-block.ll

  Log Message:
  -----------
  [CodeGenPrepare] Eliminate llvm.expect before removing empty blocks

CodeGenPrepare currently first removes empty blocks, then in a loop
performs other optimizations. One of those optimizations is the removal
of call instructions that invoke @llvm.assume, which can create new
empty blocks.

This means that when a branch only contains a call to __builtin_assume(),
the empty branch will survive into MIR, and will then only be
half-removed by MIR-level optimizations (e.g. removing the branch but
leaving the condition intact).

Fix it by eliminating @llvm.expect builtin calls before removing empty
blocks.

Reviewed By: bkramer

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




More information about the All-commits mailing list