[all-commits] [llvm/llvm-project] b21fa1: [LoopVersioning] Add a check to see if the input l...

Vedant Paranjape via All-commits all-commits at lists.llvm.org
Mon Dec 16 08:55:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b21fa18b44dd73284bd1c6551b8046c94f84f9f3
      https://github.com/llvm/llvm-project/commit/b21fa18b44dd73284bd1c6551b8046c94f84f9f3
  Author: Vedant Paranjape <22630228+VedantParanjape at users.noreply.github.com>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M llvm/lib/Transforms/Utils/LoopVersioning.cpp
    A llvm/test/Transforms/LoopVersioning/crash-36998.ll

  Log Message:
  -----------
  [LoopVersioning] Add a check to see if the input loop is in LCSSA form (#116443)

Loop Optimizations expect the input loop to be in LCSSA form. But it
seems that LoopVersioning doesn't have any check to see if the loop is
actually in LCSSA form. As a result, if we give it a loop which is not
in LCSSA form but still correct semantically, the resulting
transformation fails to pass through verifier pass with the following
error.

Instruction does not dominate all uses!
%inc = add nsw i16 undef, 1
store i16 %inc, ptr @c, align 1

As the loop is not in LCSSA form, LoopVersioning's transformations leads
to invalid IR! As some instructions do not dominate all their uses.

This patch checks if a loop is in LCSSA form, if not it will call
formLCSSARecursively on the loop before passing it to LoopVersioning.

Fixes: #36998



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list