mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
[AA] Updates for D95543.
Addressing latter comments in D95543: - `AliasResult::Result` renamed to `AliasResult::Kind` - Offset printing added for `PartialAlias` case in `-aa-eval` - Removed VisitedPhiBBs check from BasicAA' Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D100454
This commit is contained in:
parent
53489ff399
commit
7b0a514671
@ -90,7 +90,7 @@ private:
|
||||
signed int Offset : OffsetBits;
|
||||
|
||||
public:
|
||||
enum Result : uint8_t {
|
||||
enum Kind : uint8_t {
|
||||
/// The two locations do not alias at all.
|
||||
///
|
||||
/// This value is arranged to convert to false, while all other values
|
||||
@ -109,10 +109,10 @@ public:
|
||||
"Not enough bit field size for the enum!");
|
||||
|
||||
explicit AliasResult() = delete;
|
||||
constexpr AliasResult(const Result &Alias)
|
||||
constexpr AliasResult(const Kind &Alias)
|
||||
: Alias(Alias), HasOffset(false), Offset(0) {}
|
||||
|
||||
operator Result() const { return static_cast<Result>(Alias); }
|
||||
operator Kind() const { return static_cast<Kind>(Alias); }
|
||||
|
||||
constexpr bool hasOffset() const { return HasOffset; }
|
||||
constexpr int32_t getOffset() const {
|
||||
@ -127,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
/// Helper for processing AliasResult for swapped memory location pairs.
|
||||
void swap(bool DoSwap) {
|
||||
void swap(bool DoSwap = true) {
|
||||
if (DoSwap && hasOffset())
|
||||
setOffset(-getOffset());
|
||||
}
|
||||
|
@ -460,6 +460,8 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, AliasResult AR) {
|
||||
break;
|
||||
case AliasResult::PartialAlias:
|
||||
OS << "PartialAlias";
|
||||
if (AR.hasOffset())
|
||||
OS << " (off " << AR.getOffset() << ")";
|
||||
break;
|
||||
}
|
||||
return OS;
|
||||
|
@ -51,8 +51,11 @@ static void PrintResults(AliasResult AR, bool P, const Value *V1,
|
||||
V2->printAsOperand(os2, true, M);
|
||||
}
|
||||
|
||||
if (o2 < o1)
|
||||
if (o2 < o1) {
|
||||
std::swap(o1, o2);
|
||||
// Change offset sign for the local AR, for printing only.
|
||||
AR.swap();
|
||||
}
|
||||
errs() << " " << AR << ":\t" << o1 << ", " << o2 << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -1111,8 +1111,8 @@ AliasResult BasicAAResult::aliasGEP(
|
||||
// Conservatively drop processing if a phi was visited and/or offset is
|
||||
// too big.
|
||||
AliasResult AR = AliasResult::PartialAlias;
|
||||
if (VisitedPhiBBs.empty() && VRightSize.hasValue() &&
|
||||
Off.ule(INT32_MAX) && (Off + VRightSize.getValue()).ule(LSize)) {
|
||||
if (VRightSize.hasValue() && Off.ule(INT32_MAX) &&
|
||||
(Off + VRightSize.getValue()).ule(LSize)) {
|
||||
// Memory referenced by right pointer is nested. Save the offset in
|
||||
// cache. Note that originally offset estimated as GEP1-V2, but
|
||||
// AliasResult contains the shift that represents GEP1+Offset=V2.
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: opt -basic-aa -aa-eval -print-all-alias-modref-info %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basic-aa -aa-eval -print-all-alias-modref-info -disable-output %s 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "p:64:64:64"
|
||||
|
||||
@ -6,7 +6,7 @@ target datalayout = "p:64:64:64"
|
||||
define void @may_overflow_mul_add_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_mul_add_i8: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.6
|
||||
; CHECK-NEXT: PartialAlias (off 6): [16 x i8]* %ptr, i8* %gep.6
|
||||
; CHECK-NEXT: MayAlias: i8* %gep.6, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i8 %idx, 5
|
||||
@ -21,7 +21,7 @@ define void @may_overflow_mul_add_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
define void @nuw_nsw_mul_add_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
; CHECK-LABEL: Function: nuw_nsw_mul_add_i8: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.6
|
||||
; CHECK-NEXT: PartialAlias (off 6): [16 x i8]* %ptr, i8* %gep.6
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.6, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw nsw i8 %idx, 5
|
||||
@ -37,7 +37,7 @@ define void @nuw_nsw_mul_add_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
define void @may_overflow_mul_sub_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_mul_sub_i8: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: MayAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i8 %idx, 5
|
||||
@ -52,7 +52,7 @@ define void @may_overflow_mul_sub_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
define void @nuw_nsw_mul_sub_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
; CHECK-LABEL: Function: nuw_nsw_mul_sub_i8: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw nsw i8 %idx, 5
|
||||
@ -69,7 +69,7 @@ define void @nuw_nsw_mul_sub_i8([16 x i8]* %ptr, i8 %idx) {
|
||||
define void @may_overflow_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_mul_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i64 %idx, 5
|
||||
@ -84,7 +84,7 @@ define void @may_overflow_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @nuw_nsw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: nuw_nsw_mul_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw nsw i64 %idx, 5
|
||||
@ -99,7 +99,7 @@ define void @nuw_nsw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @only_nsw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: only_nsw_mul_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nsw i64 %idx, 5
|
||||
@ -114,7 +114,7 @@ define void @only_nsw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @only_nuw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: only_nuw_mul_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw i64 %idx, 5
|
||||
@ -129,7 +129,7 @@ define void @only_nuw_mul_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @may_overflow_mul_pow2_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_mul_pow2_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i64 %idx, 8
|
||||
@ -145,7 +145,7 @@ define void @may_overflow_mul_pow2_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @mul_pow2_sub_nsw_nuw_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: mul_pow2_sub_nsw_nuw_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i64 %idx, 8
|
||||
@ -160,7 +160,7 @@ define void @mul_pow2_sub_nsw_nuw_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @may_overflow_shl_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_shl_sub_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: MayAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = shl i64 %idx, 2
|
||||
@ -175,7 +175,7 @@ define void @may_overflow_shl_sub_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @shl_sub_nsw_nuw_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
; CHECK-LABEL: Function: shl_sub_nsw_nuw_i64: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = shl i64 %idx, 3
|
||||
@ -191,7 +191,7 @@ define void @shl_sub_nsw_nuw_i64([16 x i8]* %ptr, i64 %idx) {
|
||||
define void @may_overflow_i32_sext([16 x i8]* %ptr, i32 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_i32_sext: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: MayAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i32 %idx, 678152731
|
||||
@ -207,7 +207,7 @@ define void @may_overflow_i32_sext([16 x i8]* %ptr, i32 %idx) {
|
||||
define void @nuw_nsw_i32_sext([16 x i8]* %ptr, i32 %idx) {
|
||||
; CHECK-LABEL: Function: nuw_nsw_i32_sext: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: NoAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw nsw i32 %idx, 678152731
|
||||
@ -224,7 +224,7 @@ define void @nuw_nsw_i32_sext([16 x i8]* %ptr, i32 %idx) {
|
||||
define void @may_overflow_i32_zext([16 x i8]* %ptr, i32 %idx) {
|
||||
; CHECK-LABEL: Function: may_overflow_i32_zext: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: MayAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: MayAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul i32 %idx, 678152731
|
||||
@ -240,7 +240,7 @@ define void @may_overflow_i32_zext([16 x i8]* %ptr, i32 %idx) {
|
||||
define void @nuw_nsw_i32_zext([16 x i8]* %ptr, i32 %idx) {
|
||||
; CHECK-LABEL: Function: nuw_nsw_i32_zext: 3 pointers, 0 call sites
|
||||
; CHECK-NEXT: NoAlias: [16 x i8]* %ptr, i8* %gep.idx
|
||||
; CHECK-NEXT: PartialAlias: [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: PartialAlias (off 3): [16 x i8]* %ptr, i8* %gep.3
|
||||
; CHECK-NEXT: NoAlias: i8* %gep.3, i8* %gep.idx
|
||||
;
|
||||
%mul = mul nuw nsw i32 %idx, 678152731
|
||||
|
@ -17,12 +17,12 @@
|
||||
; CHECK-GVN: testLaunderInvariantGroupIsNotEscapeSource
|
||||
define i8 @testLaunderInvariantGroupIsNotEscapeSource() {
|
||||
; CHECK-DAG: MustAlias: %struct.A* %a, i8* %a.bitcast
|
||||
; CHECK-DAG: PartialAlias: %struct.A* %a, i8* %n
|
||||
; CHECK-DAG: PartialAlias (off {{[0-9]+}}): %struct.A* %a, i8* %n
|
||||
; CHECK-DAG: NoAlias: i8* %a.bitcast, i8* %n
|
||||
; CHECK-DAG: MustAlias: %struct.A* %a, i8* %a.laundered
|
||||
; CHECK-DAG: MustAlias: i8* %a.bitcast, i8* %a.laundered
|
||||
; CHECK-DAG: NoAlias: i8* %a.laundered, i8* %n
|
||||
; CHECK-DAG: PartialAlias: %struct.A* %a, i8* %n.laundered
|
||||
; CHECK-DAG: PartialAlias (off {{[0-9]+}}): %struct.A* %a, i8* %n.laundered
|
||||
; CHECK-DAG: NoAlias: i8* %a.bitcast, i8* %n.laundered
|
||||
; CHECK-DAG: MustAlias: i8* %n, i8* %n.laundered
|
||||
; CHECK-DAG: NoAlias: i8* %a.laundered, i8* %n.laundered
|
||||
|
@ -34,7 +34,7 @@ end:
|
||||
|
||||
; CHECK-LABEL: Function: notmust: 6 pointers, 0 call sites
|
||||
; CHECK: MustAlias: [2 x i32]* %tab, i8* %0
|
||||
; CHECK: PartialAlias: [2 x i32]* %tab, i32* %arrayidx
|
||||
; CHECK: PartialAlias (off 4): [2 x i32]* %tab, i32* %arrayidx
|
||||
; CHECK: NoAlias: i32* %arrayidx, i8* %0
|
||||
; CHECK: MustAlias: [2 x i32]* %tab, i32* %arrayidx1
|
||||
; CHECK: MustAlias: i32* %arrayidx1, i8* %0
|
||||
@ -89,7 +89,7 @@ if.end: ; preds = %f.exit
|
||||
; CHECK: MustAlias: [10 x i32]* %tab, i8* %0
|
||||
; CHECK: MustAlias: [10 x i32]* %tab, i32* %arrayidx
|
||||
; CHECK: MustAlias: i32* %arrayidx, i8* %0
|
||||
; CHECK: PartialAlias: [10 x i32]* %tab, i32* %arrayidx1
|
||||
; CHECK: PartialAlias (off 36): [10 x i32]* %tab, i32* %arrayidx1
|
||||
; CHECK: NoAlias: i32* %arrayidx1, i8* %0
|
||||
; CHECK: NoAlias: i32* %arrayidx, i32* %arrayidx1
|
||||
; CHECK: MayAlias: [10 x i32]* %tab, i32* %p.addr.05.i
|
||||
@ -141,7 +141,7 @@ if.end: ; preds = %f.exit
|
||||
; CHECK-LABEL: Function: negative: 6 pointers, 1 call sites
|
||||
; CHECK: NoAlias: [3 x i16]* %int_arr.10, i16** %argv.6.par
|
||||
; CHECK: NoAlias: i16* %_tmp1, i16** %argv.6.par
|
||||
; CHECK: PartialAlias: [3 x i16]* %int_arr.10, i16* %_tmp1
|
||||
; CHECK: PartialAlias (off 4): [3 x i16]* %int_arr.10, i16* %_tmp1
|
||||
; CHECK: NoAlias: i16* %ls1.9.0, i16** %argv.6.par
|
||||
; CHECK: MayAlias: [3 x i16]* %int_arr.10, i16* %ls1.9.0
|
||||
; CHECK: MayAlias: i16* %_tmp1, i16* %ls1.9.0
|
||||
@ -150,7 +150,7 @@ if.end: ; preds = %f.exit
|
||||
; CHECK: MayAlias: i16* %_tmp1, i16* %_tmp7
|
||||
; CHECK: NoAlias: i16* %_tmp7, i16* %ls1.9.0
|
||||
; CHECK: NoAlias: i16* %_tmp11, i16** %argv.6.par
|
||||
; CHECK: PartialAlias: [3 x i16]* %int_arr.10, i16* %_tmp11
|
||||
; CHECK: PartialAlias (off 2): [3 x i16]* %int_arr.10, i16* %_tmp11
|
||||
; CHECK: NoAlias: i16* %_tmp1, i16* %_tmp11
|
||||
; CHECK: MayAlias: i16* %_tmp11, i16* %ls1.9.0
|
||||
; CHECK: MayAlias: i16* %_tmp11, i16* %_tmp7
|
||||
|
Loading…
Reference in New Issue
Block a user