18 changes: 9 additions & 9 deletions llvm/test/Transforms/LICM/hoist-deref-load.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target triple = "x86_64-unknown-linux-gnu"
; CHECK: load i32, i32* %c, align 4
; CHECK: for.body:

define void @test1(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* nocapture readonly nonnull dereferenceable(4) %c, i32 %n) #0 {
define void @test1(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* nocapture readonly nonnull dereferenceable(4) align 4 %c, i32 %n) #0 {
entry:
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body, label %for.end
Expand Down Expand Up @@ -99,7 +99,7 @@ for.end: ; preds = %for.inc, %entry
; CHECK: load i32, i32* %c2, align 4
; CHECK: for.body:

define void @test3(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* nocapture readonly dereferenceable(12) %c, i32 %n) #0 {
define void @test3(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* nocapture readonly dereferenceable(12) align 4 %c, i32 %n) #0 {
entry:
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body, label %for.end
Expand Down Expand Up @@ -183,7 +183,7 @@ for.end: ; preds = %for.inc, %entry
; CHECK: load i32, i32* %c, align 4
; CHECK: for.body:

define void @test5(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) %c, i32 %n) #0 {
define void @test5(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) align 4 %c, i32 %n) #0 {
entry:
%not_null = icmp ne i32* %c, null
br i1 %not_null, label %not.null, label %for.end
Expand Down Expand Up @@ -274,7 +274,7 @@ for.end: ; preds = %for.inc, %entry

define void @test7(i32* noalias %a, i32* %b, i32** %cptr, i32 %n) #0 {
entry:
%c = load i32*, i32** %cptr, !dereferenceable !0
%c = load i32*, i32** %cptr, !dereferenceable !0, !align !{i64 4}
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body, label %for.end

Expand Down Expand Up @@ -321,7 +321,7 @@ for.end: ; preds = %for.inc, %entry

define void @test8(i32* noalias %a, i32* %b, i32** %cptr, i32 %n) #0 {
entry:
%c = load i32*, i32** %cptr, !dereferenceable_or_null !0
%c = load i32*, i32** %cptr, !dereferenceable_or_null !0, !align !{i64 4}
%not_null = icmp ne i32* %c, null
br i1 %not_null, label %not.null, label %for.end

Expand Down Expand Up @@ -405,7 +405,7 @@ for.end: ; preds = %for.inc, %entry
; CHECK: if.then:
; CHECK: load i32, i32* %c, align 4

define void @test10(i32* noalias %a, i32* %b, i32** dereferenceable(8) %cptr, i32 %n) #0 {
define void @test10(i32* noalias %a, i32* %b, i32** dereferenceable(8) align 8 %cptr, i32 %n) #0 {
entry:
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body, label %for.end
Expand Down Expand Up @@ -475,7 +475,7 @@ for.end: ; preds = %for.inc, %entry

declare void @llvm.experimental.guard(i1, ...)

define void @test12(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) %c, i32 %n) #0 {
define void @test12(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) align 4 %c, i32 %n) #0 {
; Prove non-null ness of %c via a guard, not a branch.

; CHECK-LABEL: @test12(
Expand Down Expand Up @@ -560,7 +560,7 @@ for.end: ; preds = %for.inc, %entry, %e

; Check that branch by condition "null check AND something" allows to hoist the
; load.
define void @test14(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) %c, i32 %n, i1 %dummy_cond) #0 {
define void @test14(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) align 4 %c, i32 %n, i1 %dummy_cond) #0 {

; CHECK-LABEL: @test14
; CHECK: load i32, i32* %c, align 4
Expand Down Expand Up @@ -602,7 +602,7 @@ for.end: ; preds = %for.inc, %entry, %n

; Check that guard by condition "null check AND something" allows to hoist the
; load.
define void @test15(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) %c, i32 %n, i1 %dummy_cond) #0 {
define void @test15(i32* noalias %a, i32* %b, i32* dereferenceable_or_null(4) align 4 %c, i32 %n, i1 %dummy_cond) #0 {

; CHECK-LABEL: @test15
; CHECK: load i32, i32* %c, align 4
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ end:
ret i8* %x10
}

define i32* @test5(i32 %a, i32 %b, i32 %c, i32* dereferenceable(10) %ptr1, i32* dereferenceable(10) %ptr2, i32** dereferenceable(10) %ptr3) {
define i32* @test5(i32 %a, i32 %b, i32 %c, i32* dereferenceable(10) %ptr1, i32* dereferenceable(10) %ptr2, i32** dereferenceable(10) align 8 %ptr3) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T1:%.*]] = icmp eq i32 [[B:%.*]], 0
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/TailCallElim/reorder_load.ll
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ recurse: ; preds = %else

; This load can be moved above the call because the function won't write to it
; and the a_arg is dereferenceable.
define fastcc i32 @raise_load_5(i32* dereferenceable(4) %a_arg, i32 %a_len_arg, i32 %start_arg) readonly {
define fastcc i32 @raise_load_5(i32* dereferenceable(4) align 4 %a_arg, i32 %a_len_arg, i32 %start_arg) readonly {
; CHECK-LABEL: @raise_load_5(
; CHECK-NOT: call
; CHECK: load i32, i32*
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/IR/FunctionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ TEST(FunctionTest, GetPointerAlignment) {
FunctionType *FuncType(FunctionType::get(VoidType, false));
std::unique_ptr<Function> Func(Function::Create(
FuncType, GlobalValue::ExternalLinkage));
EXPECT_EQ(MaybeAlign(), Func->getPointerAlignment(DataLayout("")));
EXPECT_EQ(Align(1), Func->getPointerAlignment(DataLayout("")));
EXPECT_EQ(Align(1), Func->getPointerAlignment(DataLayout("Fi8")));
EXPECT_EQ(Align(1), Func->getPointerAlignment(DataLayout("Fn8")));
EXPECT_EQ(Align(2), Func->getPointerAlignment(DataLayout("Fi16")));
Expand All @@ -153,7 +153,7 @@ TEST(FunctionTest, GetPointerAlignment) {

Func->setAlignment(Align(4));

EXPECT_EQ(MaybeAlign(), Func->getPointerAlignment(DataLayout("")));
EXPECT_EQ(Align(1), Func->getPointerAlignment(DataLayout("")));
EXPECT_EQ(Align(1), Func->getPointerAlignment(DataLayout("Fi8")));
EXPECT_EQ(Align(4), Func->getPointerAlignment(DataLayout("Fn8")));
EXPECT_EQ(Align(2), Func->getPointerAlignment(DataLayout("Fi16")));
Expand Down
2 changes: 1 addition & 1 deletion polly/test/ScopInfo/invariant_load_dereferenceable.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

; CHECK-NOT: Function: foo_undereferanceable

define void @foo_dereferanceable(double* %A, double* %B, i64* dereferenceable(8) %sizeA_ptr,
define void @foo_dereferanceable(double* %A, double* %B, i64* dereferenceable(8) align 8 %sizeA_ptr,
i32 %lb.i, i32 %lb.j, i32 %ub.i, i32 %ub.j) {
entry:
br label %for.i
Expand Down