[all-commits] [llvm/llvm-project] 90d178: [DSE] Fix invalid removal of store instruction

Marianne Mailhot-Sarrasin via All-commits all-commits at lists.llvm.org
Wed Dec 22 13:16:40 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 90d1786ba0c233456b7785fe4b93eca835d56028
  Author: Marianne Mailhot-Sarrasin <marianne.ms.qc at gmail.com>
  Date:   2021-12-22 (Wed, 22 Dec 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    M llvm/test/Transforms/DeadStoreElimination/store-after-loop.ll

  Log Message:
  [DSE] Fix invalid removal of store instruction

Fix handling of alloc-like instructions in isGuaranteedLoopInvariant(). It was not valid when the 'KillingDef' was outside of the loop, while the 'CurrentDef' was inside the loop. In that case, the 'KillingDef' only overwrites the definition from the last iteration of the loop, and not the ones of all iterations. Therefor it does not make the 'CurrentDef' to be dead, and must not remove it.

Fixing issue : https://github.com/llvm/llvm-project/issues/52774

Reviewed by: Florian Hahn

Differential revision: https://reviews.llvm.org/D115965

More information about the All-commits mailing list