1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/LoopDistribute/pr28443.ll
Adam Nemet ffa0068101 [LDist] Match behavior between invoking via optimization pipeline or opt -loop-distribute
In r267672, where the loop distribution pragma was introduced, I tried
it hard to keep the old behavior for opt: when opt is invoked
with -loop-distribute, it should distribute the loop (it's off by
default when ran via the optimization pipeline).

As MichaelZ has discovered this has the unintended consequence of
breaking a very common developer work-flow to reproduce compilations
using opt: First you print the pass pipeline of clang
with -debug-pass=Arguments and then invoking opt with the returned
arguments.

clang -debug-pass will include -loop-distribute but the pass is invoked
with default=off so nothing happens unless the loop carries the pragma.
While through opt (default=on) we will try to distribute all loops.

This changes opt's default to off as well to match clang.  The tests are
modified to explicitly enable the transformation.

llvm-svn: 290235
2016-12-21 04:07:40 +00:00

37 lines
1.4 KiB
LLVM

; RUN: opt -basicaa -loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S \
; RUN: < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @fn1(i64 %a, i64* %b) {
entry:
br label %for.body
for.body:
%add75.epil = phi i64 [ %add7.epil, %for.body ], [ %a, %entry ]
%add1.epil = add nsw i64 %add75.epil, 268435457
%arrayidx.epil = getelementptr inbounds i64, i64* %b, i64 %add1.epil
%load = load i64, i64* %arrayidx.epil, align 8
%add5.epil = add nsw i64 %add75.epil, 805306369
%arrayidx6.epil = getelementptr inbounds i64, i64* %b, i64 %add5.epil
store i64 %load, i64* %arrayidx6.epil, align 8
%add7.epil = add nsw i64 %add75.epil, 2
%epil.iter.cmp = icmp eq i64 %add7.epil, 0
br i1 %epil.iter.cmp, label %for.end, label %for.body
; CHECK: %[[phi:.*]] = phi i64
; CHECK: %[[add1:.*]] = add nsw i64 %[[phi]], 268435457
; CHECK: %[[gep1:.*]] = getelementptr inbounds i64, i64* %b, i64 %[[add1]]
; CHECK: %[[load:.*]] = load i64, i64* %[[gep1]], align 8
; CHECK: %[[add2:.*]] = add nsw i64 %[[phi]], 805306369
; CHECK: %[[gep2:.*]] = getelementptr inbounds i64, i64* %b, i64 %[[add2]]
; CHECK: store i64 %[[load]], i64* %[[gep2]], align 8
; CHECK: %[[incr:.*]] = add nsw i64 %[[phi]], 2
; CHECK: %[[cmp:.*]] = icmp eq i64 %[[incr]], 0
; CHECK: br i1 %[[cmp]]
for.end:
ret void
}