[all-commits] [llvm/llvm-project] 4cdb91: [SCEV] Clarify inference in isAddRecNeverPoison()

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Apr 21 06:31:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4cdb91f9e700a74c0f40c9495d08a64365687a57
      https://github.com/llvm/llvm-project/commit/4cdb91f9e700a74c0f40c9495d08a64365687a57
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-04-21 (Fri, 21 Apr 2023)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll

  Log Message:
  -----------
  [SCEV] Clarify inference in isAddRecNeverPoison()

The justification in isAddRecNeverPoison() no longer applies, as
it dates back to a time where LLVM had an unconditional forward
progress guarantee. However, we also no longer need it, because we
can exploit branch on poison UB instead.

For a single exit loop (without abnormal exits) we know that all
instructions dominating the exit will be executed, so if any of
them trigger UB on poison that means that addrec is not poison.

This is slightly stronger than the previous code, because a) we
don't need the exit to also be the latch and b) we don't need the
value to be used in the exit branch in particular, any UB-producing
instruction is fine.

I don't expect much practical impact from this change, this is
mainly to clarify the reasoning behind this logic.

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




More information about the All-commits mailing list