llvm-project/llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll
Arthur Eubanks d0acd97c68 [NewPM][LoopUnswitch] Pin loop-unswitch to legacy PM or use simple-loop-unswitch
As mentioned in
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143395.html,
loop-unswitch has not been ported to the NPM. Instead people are using
simple-loop-unswitch.

Pin all tests in Transforms/LoopUnswitch to legacy PM and replace all
other uses of loop-unswitch with simple-loop-unswitch.

One test that didn't fit into the above was
2014-06-21-congruent-constant.ll which seems to only pass with
loop-unswitch. That is also pinned to legacy PM.

Now all tests containing "-loop-unswitch" anywhere in the test succeed with
NPM turned on by default.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D85360
2020-08-06 10:56:00 -07:00

30 lines
1.3 KiB
LLVM

; RUN: opt < %s -loop-unswitch -enable-new-pm=0 -S | FileCheck %s
; RUN: opt < %s -loop-unswitch -enable-new-pm=0 -enable-mssa-loop-dependency=true -verify-memoryssa -S | FileCheck %s
; In cases where two address spaces do not have the same size pointer, the
; input for the addrspacecast should not be used as a substitute for itself
; when manipulating the pointer.
target datalayout = "e-m:e-p:16:16-p1:32:16-i32:16-i64:16-n8:16"
define void @foo() {
; CHECK-LABEL: @foo
entry:
%arrayidx.i1 = getelementptr inbounds i16, i16* undef, i16 undef
%arrayidx.i = addrspacecast i16* %arrayidx.i1 to i16 addrspace(1)*
br i1 undef, label %for.body.i, label %bar.exit
for.body.i: ; preds = %for.body.i, %entry
; When we call makeLoopInvariant (i.e. trivial LICM) on this load, it
; will try to find the base object to prove deferenceability. If we look
; through the addrspacecast, we'll fail an assertion about bitwidths matching
; CHECK-LABEL: for.body.i
; CHECK: %0 = load i16, i16 addrspace(1)* %arrayidx.i, align 2
%0 = load i16, i16 addrspace(1)* %arrayidx.i, align 2
%cmp1.i = icmp eq i16 %0, 0
br i1 %cmp1.i, label %bar.exit, label %for.body.i
bar.exit: ; preds = %for.body.i, %entry
ret void
}