[all-commits] [llvm/llvm-project] 4eafc9: [IR] Treat callbr as special terminator (PR64215)

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Aug 25 00:20:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4eafc9b6ff4ae2bce82e9fdf0123b336825d931c
      https://github.com/llvm/llvm-project/commit/4eafc9b6ff4ae2bce82e9fdf0123b336825d931c
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-08-25 (Fri, 25 Aug 2023)

  Changed paths:
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/IR/BasicBlock.cpp
    M llvm/lib/Transforms/Coroutines/CoroElide.cpp
    M llvm/lib/Transforms/Scalar/GVN.cpp
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    M llvm/lib/Transforms/Scalar/Sink.cpp
    M llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
    M llvm/lib/Transforms/Utils/SCCPSolver.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    A llvm/test/Transforms/JumpThreading/callbr.ll
    R llvm/test/Transforms/JumpThreading/pr46857-callbr.ll
    M llvm/test/Transforms/LICM/callbr-crash.ll

  Log Message:
  -----------
  [IR] Treat callbr as special terminator (PR64215)

isLegalToHoistInto() currently return true for callbr instructions.
That means that a callbr with one successor will be considered a
proper loop preheader, which may result in instructions that use
the callbr return value being hoisted past it.

Fix this by adding callbr to isExceptionTerminator (with a rename
to isSpecialTerminator), which also fixes similar assumptions in
other places.

Fixes https://github.com/llvm/llvm-project/issues/64215.

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




More information about the All-commits mailing list