[all-commits] [llvm/llvm-project] abd2dc: [VectorCombine] Avoid double deletion in `eraseIns...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed Aug 27 07:28:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: abd2dc90c039cf8b3907f096743fc69380c8b245
      https://github.com/llvm/llvm-project/commit/abd2dc90c039cf8b3907f096743fc69380c8b245
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-08-27 (Wed, 27 Aug 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    A llvm/test/Transforms/VectorCombine/X86/pr155543.ll

  Log Message:
  -----------
  [VectorCombine] Avoid double deletion in `eraseInstruction` (#155621)

Consider the following pattern:
```
C = op A B
D = op C
E = op D, C
```
As `E` is dead, we call `eraseInstruction(E)` and see if its operands
become dead. `RecursivelyDeleteTriviallyDeadInstructions(D)` also erases
`C`, which causes a UAF crash in the subsequent call
`RecursivelyDeleteTriviallyDeadInstructions(C)`.

This patch also adds deleted ops into the visit list to avoid double
deletion.

Closes https://github.com/llvm/llvm-project/issues/155543.



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