mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
caee94bbb4
This re-lands change r230921. r230921 was reverted because it broke a clang test; a checkin fixing the clang test will be commited shortly. Summary: As far as I can tell, the real bug causing the issue was fixed in r230533. SCEVExpander should mark an increment operation as nuw or nsw only if it can *prove* that the operation does not overflow. There shouldn't be any situation where we have to do something different because of no-wrap flags generated by SCEVExpander. Revert "IndVarSimplify: Allow LFTR to fire more often" This reverts commit1ade0f0faa
(SVN: 222213). Revert "IndVarSimplify: Don't let LFTR compare against a poison value" This reverts commitc0f2b8b528
(SVN: 217102). Reviewers: majnemer, atrick, spatel Differential Revision: http://reviews.llvm.org/D7979 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231018 91177308-0d34-0410-b5e6-96231b3b80d8
70 lines
2.4 KiB
LLVM
70 lines
2.4 KiB
LLVM
; RUN: opt -S -indvars -o - %s | FileCheck %s
|
|
target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-n8:16:32:64"
|
|
|
|
; Derived from ptriv in lftr-reuse.ll
|
|
define void @ptriv_as2(i8 addrspace(2)* %base, i32 %n) nounwind {
|
|
; CHECK-LABEL: @ptriv_as2(
|
|
entry:
|
|
%idx.trunc = trunc i32 %n to i8
|
|
%add.ptr = getelementptr inbounds i8, i8 addrspace(2)* %base, i8 %idx.trunc
|
|
%cmp1 = icmp ult i8 addrspace(2)* %base, %add.ptr
|
|
br i1 %cmp1, label %for.body, label %for.end
|
|
|
|
; Make sure the added GEP has the right index type
|
|
; CHECK: %lftr.limit = getelementptr i8, i8 addrspace(2)* %base, i8 %0
|
|
|
|
; CHECK: for.body:
|
|
; CHECK: phi i8 addrspace(2)*
|
|
; CHECK-NOT: phi
|
|
; CHECK-NOT: add{{^rspace}}
|
|
; CHECK: icmp ne i8 addrspace(2)*
|
|
; CHECK: br i1
|
|
for.body:
|
|
%p.02 = phi i8 addrspace(2)* [ %base, %entry ], [ %incdec.ptr, %for.body ]
|
|
; cruft to make the IV useful
|
|
%sub.ptr.lhs.cast = ptrtoint i8 addrspace(2)* %p.02 to i8
|
|
%sub.ptr.rhs.cast = ptrtoint i8 addrspace(2)* %base to i8
|
|
%sub.ptr.sub = sub i8 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
|
|
store i8 %sub.ptr.sub, i8 addrspace(2)* %p.02
|
|
%incdec.ptr = getelementptr inbounds i8, i8 addrspace(2)* %p.02, i32 1
|
|
%cmp = icmp ult i8 addrspace(2)* %incdec.ptr, %add.ptr
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end:
|
|
ret void
|
|
}
|
|
|
|
define void @ptriv_as3(i8 addrspace(3)* %base, i32 %n) nounwind {
|
|
; CHECK-LABEL: @ptriv_as3(
|
|
entry:
|
|
%idx.trunc = trunc i32 %n to i16
|
|
%add.ptr = getelementptr inbounds i8, i8 addrspace(3)* %base, i16 %idx.trunc
|
|
%cmp1 = icmp ult i8 addrspace(3)* %base, %add.ptr
|
|
br i1 %cmp1, label %for.body, label %for.end
|
|
|
|
; Make sure the added GEP has the right index type
|
|
; CHECK: %lftr.limit = getelementptr i8, i8 addrspace(3)* %base, i16 %0
|
|
|
|
; CHECK: for.body:
|
|
; CHECK: phi i8 addrspace(3)*
|
|
; CHECK-NOT: phi
|
|
; CHECK-NOT: add{{^rspace}}
|
|
; CHECK: icmp ne i8 addrspace(3)*
|
|
; CHECK: br i1
|
|
for.body:
|
|
%p.02 = phi i8 addrspace(3)* [ %base, %entry ], [ %incdec.ptr, %for.body ]
|
|
; cruft to make the IV useful
|
|
%sub.ptr.lhs.cast = ptrtoint i8 addrspace(3)* %p.02 to i16
|
|
%sub.ptr.rhs.cast = ptrtoint i8 addrspace(3)* %base to i16
|
|
%sub.ptr.sub = sub i16 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
|
|
%conv = trunc i16 %sub.ptr.sub to i8
|
|
store i8 %conv, i8 addrspace(3)* %p.02
|
|
%incdec.ptr = getelementptr inbounds i8, i8 addrspace(3)* %p.02, i32 1
|
|
%cmp = icmp ult i8 addrspace(3)* %incdec.ptr, %add.ptr
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end:
|
|
ret void
|
|
}
|
|
|