Files
clang-p2996/llvm/test/Transforms/LICM/pr59324.ll
Nikita Popov ed76074173 [LICM] Remove custom isInstInList() implementation (PR59324)
We already collect all instructions that need to be promoted. The
custom isInstInList() implementation could provide incorrect
results if a new use of the original pointer was introduced as
part of promotion. This probably cannot happen with normal code,
because of the pointer capture, but it can happen with a null
pointer.

Fixes https://github.com/llvm/llvm-project/issues/59324.
2022-12-07 09:51:35 +01:00

22 lines
498 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=licm < %s | FileCheck %s
define void @test(ptr %a) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[V:%.*]] = load i32, ptr null, align 4
; CHECK-NEXT: br label [[LOOP]]
;
entry:
br label %loop
loop:
store ptr null, ptr null
%p = load ptr, ptr null
%v = load i32, ptr %p
store i32 %v, ptr %a
br label %loop
}