2015-11-05 21:18:43 +08:00
|
|
|
; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
|
|
|
|
;
|
|
|
|
; Check whether %newval is identified as escaping value, even though it is used
|
|
|
|
; in a phi that is in the region. Non-affine subregion case.
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: subregion_entry.region_entering:
|
|
|
|
; CHECK: %loop_carried.ph = phi float [ %newval.merge, %backedge ], [ undef, %entry ]
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: polly.merge_new_and_old:
|
2015-12-09 19:38:22 +08:00
|
|
|
; CHECK: %newval.merge = phi float [ %newval.final_reload, %polly.exiting ], [ %newval, %subregion_exit.region_exiting ]
|
2015-11-05 21:18:43 +08:00
|
|
|
;
|
|
|
|
; CHECK-LABEL: polly.start:
|
|
|
|
; CHECK: store float %loop_carried.ph, float* %loop_carried.phiops
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: polly.stmt.subregion_entry.entry:
|
|
|
|
; CHECK: %loop_carried.phiops.reload = load float, float* %loop_carried.phiops
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: polly.stmt.subregion_entry:
|
BlockGenerator: Do not redundantly reload from PHI-allocas in non-affine stmts
Before this change we created an additional reload in the copy of the incoming
block of a PHI node to reload the incoming value, even though the necessary
value has already been made available by the normally generated scalar loads.
In this change, we drop the code that generates this redundant reload and
instead just reuse the scalar value already available.
Besides making the generated code slightly cleaner, this change also makes sure
that scalar loads go through the normal logic, which means they can be remapped
(e.g. to array slots) and corresponding code is generated to load from the
remapped location. Without this change, the original scalar load at the
beginning of the non-affine region would have been remapped, but the redundant
scalar load would continue to load from the old PHI slot location.
It might be possible to further simplify the code in addOperandToPHI,
but this would not only mean to pull out getNewValue, but to also change the
insertion point update logic. As this did not work when trying it the first
time, this change is likely not trivial. To not introduce bugs last minute, we
postpone further simplications to a subsequent commit.
We also document the current behavior a little bit better.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D28892
llvm-svn: 292486
2017-01-19 22:12:45 +08:00
|
|
|
; CHECK: %polly.loop_carried = phi float [ %loop_carried.phiops.reload, %polly.stmt.subregion_entry.entry ]
|
2015-11-05 21:18:43 +08:00
|
|
|
; CHECK: %p_newval = fadd float %polly.loop_carried, 1.000000e+00
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: polly.stmt.polly.merge_new_and_old.exit:
|
|
|
|
; CHECK: %newval.final_reload = load float, float* %newval.s2a
|
|
|
|
|
|
|
|
define void @func() {
|
|
|
|
entry:
|
|
|
|
br label %subregion_entry
|
|
|
|
|
|
|
|
subregion_entry:
|
|
|
|
%loop_carried = phi float [ undef, %entry ], [ %newval, %backedge ]
|
|
|
|
%indvar = phi i32 [ 1, %entry ], [ %indvar_next, %backedge ]
|
|
|
|
%newval = fadd float %loop_carried, 1.0
|
|
|
|
%cmp = fcmp ogt float undef, undef
|
|
|
|
br i1 %cmp, label %subregion_if, label %subregion_exit
|
|
|
|
|
|
|
|
subregion_if:
|
|
|
|
br label %subregion_exit
|
|
|
|
|
|
|
|
subregion_exit:
|
|
|
|
br i1 undef, label %if_then, label %if_else
|
|
|
|
|
|
|
|
if_then:
|
|
|
|
br label %backedge
|
|
|
|
|
|
|
|
if_else:
|
|
|
|
br label %backedge
|
|
|
|
|
|
|
|
backedge:
|
|
|
|
%indvar_next = add nuw nsw i32 %indvar, 1
|
|
|
|
br i1 false, label %subregion_entry, label %exit
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|