2017-07-11 18:39:01 +08:00
|
|
|
; RUN: opt %loadPolly -polly-import-jscop \
|
Relax assert when setting access functions with invariant base pointers
Summary:
Instead of forbidding such access functions completely, we verify that their
base pointer has been hoisted and only assert in case the base pointer was
not hoisted.
I was trying for a little while to get a test case that ensures the assert is
correctly fired in case of invariant load hoisting being disabled, but I could
not find a good way to do so, as llvm-lit immediately aborts if a command
yields a non-zero return value. As we do not generally test our asserts,
not having a test case here seems OK.
This resolves http://llvm.org/PR31494
Suggested-by: Michael Kruse <llvm@meinersbur.de>
Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D28798
llvm-svn: 292213
2017-01-17 20:00:42 +08:00
|
|
|
; RUN: -polly-codegen -polly-invariant-load-hoisting -S \
|
|
|
|
; RUN: 2>&1 < %s | FileCheck %s
|
2017-01-17 01:51:28 +08:00
|
|
|
|
|
|
|
; Setting new access functions where the base pointer of the array that is newly
|
|
|
|
; accessed is only loaded within the scop itself caused incorrect code to be
|
Relax assert when setting access functions with invariant base pointers
Summary:
Instead of forbidding such access functions completely, we verify that their
base pointer has been hoisted and only assert in case the base pointer was
not hoisted.
I was trying for a little while to get a test case that ensures the assert is
correctly fired in case of invariant load hoisting being disabled, but I could
not find a good way to do so, as llvm-lit immediately aborts if a command
yields a non-zero return value. As we do not generally test our asserts,
not having a test case here seems OK.
This resolves http://llvm.org/PR31494
Suggested-by: Michael Kruse <llvm@meinersbur.de>
Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D28798
llvm-svn: 292213
2017-01-17 20:00:42 +08:00
|
|
|
; generated when invariant load hoisting is disabled. This test case checks
|
|
|
|
; that in case invariant load hoisting is enabled, we generate correct code.
|
2017-01-17 01:51:28 +08:00
|
|
|
|
2017-01-17 15:03:25 +08:00
|
|
|
; CHECK: %polly.access.polly.access.X.load = getelementptr float, float* %polly.access.X.load, i64 %polly.indvar
|
|
|
|
|
2017-01-17 01:51:28 +08:00
|
|
|
define void @invariant_base_ptr(float* noalias %Array, float** noalias %X,
|
|
|
|
float* noalias %C) {
|
|
|
|
|
|
|
|
start:
|
|
|
|
br label %loop
|
|
|
|
|
|
|
|
loop:
|
|
|
|
%indvar = phi i64 [0, %start], [%indvar.next, %latch]
|
|
|
|
%indvar.next = add i64 %indvar, 1
|
|
|
|
%cmp = icmp slt i64 %indvar, 1024
|
|
|
|
br i1 %cmp, label %body, label %exit
|
|
|
|
|
|
|
|
body:
|
|
|
|
%gep= getelementptr float, float* %Array, i64 %indvar
|
|
|
|
store float 42.0, float* %gep
|
|
|
|
br label %body2
|
|
|
|
|
|
|
|
body2:
|
|
|
|
%Base = load float*, float** %X
|
|
|
|
%gep2 = getelementptr float, float* %Base, i64 %indvar
|
|
|
|
%val2 = load float, float* %gep2
|
|
|
|
store float %val2, float* %C
|
|
|
|
br label %latch
|
|
|
|
|
|
|
|
latch:
|
|
|
|
br label %loop
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|