Files
clang-p2996/llvm/test/Transforms/LoopInterchange/no-dependence-info.ll
Madhur Amilkanthwar 0074a462f1 [LoopInterchange] Hoist isComputableLoopNest() in the control flow (#124247)
The profiling of the LLVM Test-suite reveals that a significant portion,
specifically 14,090 out of 139,323, loop nests were identified as
non-viable candidates for transformation, leading to the transform
exiting from isComputableLoopNest() without any action.

More importantly, dependence information was computed for these loop
nests before reaching the function isComputableLoopNest(), which does
not require DI and relies solely on scalar evolution (SE).

To enhance compile-time efficiency, this patch moves the call to
isComputableLoopNest() earlier in the control-flow, thereby avoiding
unnecessary dependence calculations.

The impact of this change is evident on the compile-time-tracker, with
the overall geometric mean improvement recorded at 0.11%, while the
lencode benchmark gets a more substantial benefit of 0.44%.
This improvement can be tracked in the isc-ln-exp-2 branch under my
repo.
2025-02-05 13:50:17 +05:30

53 lines
1.1 KiB
LLVM

; RUN: opt %s -passes='loop-interchange' -pass-remarks=loop-interchange -disable-output 2>&1 | FileCheck --allow-empty %s
target triple = "aarch64-unknown-linux-gnu"
; CHECK-NOT: Computed dependence info, invoking the transform.
; For the below test, backedge count cannot be computed.
; Computing backedge count requires only SCEV and should
; not require dependence info.
;
; void bar(int m, int n) {
; for (unsigned int i = 0; i < m; ++i) {
; for (unsigned int j = 0; j < m; ++j) {
; // dummy code
; }
; }
;}
define void @bar(i32 %m, i32 %n)
{
entry:
br label %outer.header
outer.header:
%m_temp1 = phi i32 [%m, %entry], [%m_temp, %outer.latch]
br label %inner.header
inner.header:
%n_temp1 = phi i32 [%n, %outer.header], [%n_temp, %inner.latch]
br label %body
body:
; dummy code
br label %inner.latch
inner.latch:
%n_temp = add i32 %n_temp1, 1
%cmp2 = icmp eq i32 %n_temp, 1
br i1 %cmp2, label %outer.latch, label %inner.header
outer.latch:
%m_temp = add i32 %n, 1
%cmp3 = icmp eq i32 %m_temp, 1
br i1 %cmp3, label %exit, label %outer.header
exit:
ret void
}