Files
clang-p2996/llvm/test/Transforms/OpenMP/attributor_recursion_crash.ll
Johannes Doerfert 0fc63d4e64 [Attributor][FIX] Ensure loop PHI replacements are dynamically unique
Similar to loads, PHIs can be used to introduce non-dynamically unique
values into the simplification "algorithm". We need to check that PHIs
do not carry such a value from one iteration into the next as can cause
downstream reasoning to fail, e.g., downstream could think a comparison
is equal because the simplified values are equal while they are defined
in different loop iterations. Similarly, instructions in cycles are now
conservatively treated as non-dynamically unique. We could do better but
I'll leave that for the future.

The change in AAUnderlyingObjects allows us to ignore dynamically unique
when we simply look for underlying objects. The user of that AA should
be aware that the result might not be a dynamically unique value.
2023-03-20 17:44:24 -07:00

57 lines
1.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt -passes=openmp-opt -S < %s | FileCheck %s
; TODO: This should have a second test case with a chain load->phi->load->phi
; A |
; \-------------/
%"struct.TS" = type { i32, ptr }
define weak amdgpu_kernel void @k() {
; CHECK-LABEL: define {{[^@]+}}@k() {
; CHECK-NEXT: BB1:
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: BB2:
; CHECK-NEXT: [[DOTPRE158_I:%.*]] = phi ptr [ null, [[BB1:%.*]] ], [ [[PRE2:%.*]], [[BB6:%.*]] ]
; CHECK-NEXT: br i1 false, label [[BB4:%.*]], label [[BB3:%.*]]
; CHECK: BB3:
; CHECK-NEXT: br label [[BB4]]
; CHECK: BB4:
; CHECK-NEXT: [[PRE1:%.*]] = phi ptr [ [[DOTPRE158_I]], [[BB3]] ], [ null, [[BB2]] ]
; CHECK-NEXT: br i1 false, label [[BB6]], label [[BB5:%.*]]
; CHECK: BB5:
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [[STRUCT_TS:%.*]], ptr [[DOTPRE158_I]], i64 0, i32 1
; CHECK-NEXT: [[Q3:%.*]] = load ptr, ptr [[GEP]], align 8
; CHECK-NEXT: br label [[BB6]]
; CHECK: BB6:
; CHECK-NEXT: [[PRE2]] = phi ptr [ null, [[BB4]] ], [ [[Q3]], [[BB5]] ]
; CHECK-NEXT: br label [[BB2]]
;
BB1:
br label %BB2
BB2:
%.pre158.i = phi ptr [ null, %BB1 ], [ %pre2, %BB6 ]
br i1 false, label %BB4, label %BB3
BB3:
br label %BB4
BB4:
%pre1 = phi ptr [ %.pre158.i, %BB3 ], [ null, %BB2 ]
br i1 false, label %BB6, label %BB5
BB5:
%gep = getelementptr inbounds %"struct.TS", ptr %pre1, i64 0, i32 1
%q3 = load ptr, ptr %gep, align 8
br label %BB6
BB6:
%pre2 = phi ptr [ null, %BB4 ], [ %q3, %BB5 ]
br label %BB2
}
!llvm.module.flags = !{!0, !1}
!0 = !{i32 7, !"openmp", i32 50}
!1 = !{i32 7, !"openmp-device", i32 50}