[all-commits] [llvm/llvm-project] cf8270: [CodeGenPrepare] Fix isIVIncrement (PR49466)

Ta-Wei Tu via All-commits all-commits at lists.llvm.org
Mon Mar 8 21:32:52 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf82700af8c658ae09b14c3d01bb1e73e48d3bd3
      https://github.com/llvm/llvm-project/commit/cf82700af8c658ae09b14c3d01bb1e73e48d3bd3
  Author: Ta-Wei Tu <tu.da.wei at gmail.com>
  Date:   2021-03-09 (Tue, 09 Mar 2021)

  Changed paths:
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    A llvm/test/CodeGen/X86/pr49466.ll

  Log Message:
  -----------
  [CodeGenPrepare] Fix isIVIncrement (PR49466)

In the NFC commit 8d835f42a57f15c0b9053bd7c41ea95821a40e5f, the check for `!L` is
moved to a separate function `getIVIncrement` which, instead of using `BO->getParent()`,
uses `PN->getParent()`. However, these two basic blocks are not necessarily the same.

https://bugs.llvm.org/show_bug.cgi?id=49466 demonstrates a case where `PN` is contained in
a loop while `BO` is not, causing the null-pointer dereference in `L->getLoopLatch()`.

This patch checks whether both `BO` and `PN` belong to the same loop before entering `getIVIncrement`.

Reviewed By: mkazantsev

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




More information about the All-commits mailing list