Files
clang-p2996/llvm/test/Transforms/GlobalOpt/recursively-delete-dead-inst-assertion.ll
Nikita Popov a0ff26e08c [GlobalOpt] Fix assertion failure during instruction deletion
This fixes the assertion failure reported in https://reviews.llvm.org/D114889#3166417,
by making RecursivelyDeleteTriviallyDeadInstructionsPermissive()
more permissive. As the function accepts a WeakTrackingVH, even if
originally only Instructions were inserted, we may end up with
different Value types after a RAUW operation. As such, we should
not assume that the vector only contains instructions.

Notably this matches the behavior of the
RecursivelyDeleteTriviallyDeadInstructions() function variant which
accepts a single value rather than vector.
2021-12-02 11:58:39 +01:00

21 lines
523 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -globalopt < %s | FileCheck %s
; In this case an instruction queued for recursive deletion gets RAUWd with
; a constant in the meantime. Make sure this does not cause an assertion
; failure.
@a = internal global i32** null
@b = internal global i32*** @a
define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT: ret void
;
%v1 = load i32***, i32**** @b
%v2 = load i32**, i32*** %v1
store i32** %v2, i32*** @a
ret void
}