-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Attributor] Add initial support for vectors in AAPointerInfo
While full support requires more work (see TODOs), this allows us to handle vector writes with a single constant value properly. For now, we can handle the same constant values stored to all elements if everything is of a fixed size.
- Loading branch information
Showing
2 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
llvm/test/Transforms/Attributor/value-simplify-pointer-info-vec.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals | ||
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT | ||
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC | ||
; | ||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
|
||
define i32 @vec_write_0() { | ||
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none) | ||
; CHECK-LABEL: define {{[^@]+}}@vec_write_0 | ||
; CHECK-SAME: () #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: ret i32 0 | ||
; | ||
%a = alloca <2 x i32> | ||
store <2 x i32> <i32 0, i32 0>, ptr %a | ||
%l1 = load i32, ptr %a | ||
%g = getelementptr i32, ptr %a, i64 1 | ||
%l2 = load i32, ptr %g | ||
%add = add i32 %l1, %l2 | ||
ret i32 %add | ||
} | ||
|
||
define i32 @vec_write_1() { | ||
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none) | ||
; CHECK-LABEL: define {{[^@]+}}@vec_write_1 | ||
; CHECK-SAME: () #[[ATTR0]] { | ||
; CHECK-NEXT: ret i32 10 | ||
; | ||
%a = alloca <2 x i32> | ||
store <2 x i32> <i32 5, i32 5>, ptr %a | ||
%l1B = load i32, ptr %a | ||
%g = getelementptr i32, ptr %a, i64 1 | ||
%l2B = load i32, ptr %g | ||
%add = add i32 %l1B, %l2B | ||
ret i32 %add | ||
} | ||
|
||
; TODO: We should support this. | ||
define i32 @vec_write_2() { | ||
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none) | ||
; CHECK-LABEL: define {{[^@]+}}@vec_write_2 | ||
; CHECK-SAME: () #[[ATTR0]] { | ||
; CHECK-NEXT: [[A:%.*]] = alloca <2 x i32>, align 8 | ||
; CHECK-NEXT: store <2 x i32> <i32 3, i32 5>, ptr [[A]], align 8 | ||
; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[A]], align 8 | ||
; CHECK-NEXT: [[G:%.*]] = getelementptr i32, ptr [[A]], i64 1 | ||
; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[G]], align 4 | ||
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[L1]], [[L2]] | ||
; CHECK-NEXT: ret i32 [[ADD]] | ||
; | ||
%a = alloca <2 x i32> | ||
store <2 x i32> <i32 3, i32 5>, ptr %a | ||
%l1 = load i32, ptr %a | ||
%g = getelementptr i32, ptr %a, i64 1 | ||
%l2 = load i32, ptr %g | ||
%add = add i32 %l1, %l2 | ||
ret i32 %add | ||
} | ||
;. | ||
; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn memory(none) } | ||
;. | ||
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | ||
; CGSCC: {{.*}} | ||
; TUNIT: {{.*}} |