1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/IndVarSimplify/lftr-extend-const.ll
Mehdi Amini 29ebc2d39f Make DataLayout Non-Optional in the Module
Summary:
DataLayout keeps the string used for its creation.

As a side effect it is no longer needed in the Module.
This is "almost" NFC, the string is no longer
canonicalized, you can't rely on two "equals" DataLayout
having the same string returned by getStringRepresentation().

Get rid of DataLayoutPass: the DataLayout is in the Module

The DataLayout is "per-module", let's enforce this by not
duplicating it more than necessary.
One more step toward non-optionality of the DataLayout in the
module.

Make DataLayout Non-Optional in the Module

Module->getDataLayout() will never returns nullptr anymore.

Reviewers: echristo

Subscribers: resistor, llvm-commits, jholewinski

Differential Revision: http://reviews.llvm.org/D7992

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231270
2015-03-04 18:43:29 +00:00

49 lines
1.3 KiB
LLVM

;RUN: opt -S %s -indvars | FileCheck %s
; Provide legal integer types.
target datalayout = "n8:16:32:64"
; CHECK-LABEL: @foo(
; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16
; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512
define void @foo() #0 {
entry:
br label %for.body
for.body: ; preds = %entry, %for.body
%i.01 = phi i16 [ 0, %entry ], [ %inc, %for.body ]
%conv2 = sext i16 %i.01 to i32
call void @bar(i32 %conv2) #1
%inc = add i16 %i.01, 1
%cmp = icmp slt i16 %inc, 512
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
; Check that post-incrementing the backedge taken count does not overflow.
; CHECK-LABEL: @postinc(
; CHECK: icmp eq i32 %indvars.iv, 255
define i32 @postinc() #0 {
entry:
br label %do.body
do.body: ; preds = %do.body, %entry
%first.0 = phi i8 [ 0, %entry ], [ %inc, %do.body ]
%conv = zext i8 %first.0 to i32
call void @bar(i32 %conv) #1
%inc = add i8 %first.0, 1
%cmp = icmp eq i8 %first.0, -1
br i1 %cmp, label %do.end, label %do.body
do.end: ; preds = %do.body
ret i32 0
}
declare void @bar(i32)
attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind }