Nikita Popov 57d57b1afd [AAEval] Make compatible with opaque pointers
With opaque pointers, we cannot use the pointer element type to
determine the LocationSize for the AA query. Instead, -aa-eval
tests are now required to have an explicit load or store for any
pointer they want to compute alias results for, and the load/store
types are used to determine the location size.

This may affect ordering of results, and sorting within one result,
as the type is not considered part of the sorted string anymore.

To somewhat minimize the churn, printing still uses faux typed
pointer notation.
2022-03-16 10:02:11 +01:00

32 lines
1.3 KiB
LLVM

; RUN: opt %s -S -aa-pipeline=cfl-steens-aa -passes=aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
;
; Regression: we weren't properly checking constexpr selects.
@g = extern_weak dso_local global i32, align 4
@g2 = extern_weak dso_local global i32, align 4
@g3 = extern_weak dso_local global i32, align 4
; CHECK-LABEL: Function: foo
; CHECK-DAG: NoAlias: i32** %a, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
; CHECK-DAG: NoAlias: i32** %a, i32* %b
; CHECK-DAG: MayAlias: i32* %b, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
; CHECK-DAG: NoAlias: i32** %a, i32* @g2
; CHECK-DAG: MayAlias: i32* @g2, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
; CHECK-DAG: MayAlias: i32* %b, i32* @g2
; CHECK-DAG: NoAlias: i32** %a, i32* @g3
; CHECK-DAG: MayAlias: i32* @g3, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
; CHECK-DAG: MayAlias: i32* %b, i32* @g3
; CHECK-DAG: MayAlias: i32* @g2, i32* @g3
define void @foo() {
entry:
%a = alloca i32*, align 8
load i32, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
store i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3), i32** %a
%b = load i32*, i32** %a
%c = load i32, i32* %b
%d = load i32, i32* @g2
%e = load i32, i32* @g3
ret void
}