Lex.getLoc(),
"Can't read textual IR with a Context that discards named Values");
+ if (M) {
+ if (ParseTargetDefinitions())
+ return true;
+ }
+
return ParseTopLevelEntities() || ValidateEndOfModule() ||
ValidateEndOfIndex();
}
// Top-Level Entities
//===----------------------------------------------------------------------===//
+bool LLParser::ParseTargetDefinitions() {
+ while (true) {
+ switch (Lex.getKind()) {
+ case lltok::kw_target:
+ if (ParseTargetDefinition())
+ return true;
+ break;
+ case lltok::kw_source_filename:
+ if (ParseSourceFileName())
+ return true;
+ break;
+ default:
+ return false;
+ }
+ }
+}
+
bool LLParser::ParseTopLevelEntities() {
// If there is no Module, then parse just the summary index entries.
if (!M) {
case lltok::kw_declare: if (ParseDeclare()) return true; break;
case lltok::kw_define: if (ParseDefine()) return true; break;
case lltok::kw_module: if (ParseModuleAsm()) return true; break;
- case lltok::kw_target: if (ParseTargetDefinition()) return true; break;
- case lltok::kw_source_filename:
- if (ParseSourceFileName())
- return true;
- break;
case lltok::kw_deplibs: if (ParseDepLibs()) return true; break;
case lltok::LocalVarID: if (ParseUnnamedType()) return true; break;
case lltok::LocalVar: if (ParseNamedType()) return true; break;
bool ParseTopLevelEntities();
bool ValidateEndOfModule();
bool ValidateEndOfIndex();
+ bool ParseTargetDefinitions();
bool ParseTargetDefinition();
bool ParseModuleAsm();
bool ParseSourceFileName();
ret void
}
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
; unsigned i, j;
; for (i = 1; i < SIZE; i++) {
; for (j = i; j < SIZE; j++) {
;
; PR12929: cast<Ty>() argument of incompatible type
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+
declare void @use(i8 %x)
; CHECK: @func
; CHECK: %0 = add i8 %inc1, 10
; CHECK: br label %for.cond
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
define void @func() noreturn nounwind uwtable ssp {
entry:
br label %for.cond
; When merging zero sized alloca check that requested alignments of the allocas
; are obeyed.
-@x = global i8* null, align 8
-@y = global i8* null, align 8
-
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
+@x = global i8* null, align 8
+@y = global i8* null, align 8
+
; CHECK-LABEL: @f(
; CHECK-NEXT: alloca [0 x i8], align 1024
; CHECK-NOT: alloca
; RUN: opt -instcombine -S < %s | FileCheck %s
-%struct.matrix_float3x3 = type { [3 x <3 x float>] }
-
; We used to fold this by rewriting the indices to 0, 0, 2, 0. This is
; invalid because there is a 4-byte padding after each <3 x float> field.
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
+%struct.matrix_float3x3 = type { [3 x <3 x float>] }
+
@matrix_identity_float3x3 = external global %struct.matrix_float3x3, align 16
@bbb = global float* getelementptr inbounds (%struct.matrix_float3x3, %struct.matrix_float3x3* @matrix_identity_float3x3, i64 0, i32 0, i64 1, i64 3)
; CHECK: @bbb = global float* getelementptr inbounds (%struct.matrix_float3x3, %struct.matrix_float3x3* @matrix_identity_float3x3, i64 0, i32 0, i64 1, i64 3)
; RUN: opt -S -instcombine < %s | FileCheck %s
+; The last test needs this weird datalayout.
+target datalayout = "i32:8:8"
+; Without it, InstCombine will align the pointed on 4 Bytes
+; The KnownBitsZero that result from the alignment allows to
+; turn:
+; and i32 %mul, 255
+; to:
+; and i32 %mul, 252
+; The mask is no longer in the form 2^n-1 and this prevents the transformation.
+
+
; return mul(zext x, zext y) > MAX
define i32 @pr4917_1(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: @pr4917_1(
}
-; The last test needs this weird datalayout.
-target datalayout = "i32:8:8"
-; Without it, InstCombine will align the pointed on 4 Bytes
-; The KnownBitsZero that result from the alignment allows to
-; turn:
-; and i32 %mul, 255
-; to:
-; and i32 %mul, 252
-; The mask is no longer in the form 2^n-1 and this prevents the transformation.
-
@pr21445_data = external global i32
define i1 @pr21445(i8 %a) {
; CHECK-LABEL: @pr21445(
;
; RUN: opt < %s -instcombine -S | FileCheck %s
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+
; Test behavior for wchar_size==2
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"wchar_size", i32 2}
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
declare i64 @wcslen(i16*)
@hello = constant [6 x i16] [i16 104, i16 101, i16 108, i16 108, i16 111, i16 0]
; RUN: opt -loop-idiom < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -S | FileCheck %s
+target triple = "x86_64-apple-macosx10.8.0"
+
;To recognize this pattern:
;int popcount(unsigned long long a) {
; int c = 0;
}
; Some variants once cause crash
-target triple = "x86_64-apple-macosx10.8.0"
define i32 @PopCntCrash1(i64 %a) nounwind uwtable readnone ssp {
entry:
; CHECK: LV: Not vectorizing: Outer loop contains divergent loops.
; CHECK: LV: Not vectorizing: Unsupported outer loop.
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
define void @loop_ub(i32* nocapture %a, i32* nocapture readonly %b, i32 %N, i32 %M) local_unnamed_addr {
entry:
%cmp32 = icmp sgt i32 %N, 0
; CHECK: LV: Not vectorizing: Outer loop contains divergent loops.
; CHECK: LV: Not vectorizing: Unsupported outer loop.
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
define void @iv_step(i32* nocapture %a, i32* nocapture readonly %b, i32 %N, i32 %M) local_unnamed_addr {
entry:
%cmp33 = icmp sgt i32 %N, 0
; CHECK: Unsupported conditional branch.
; CHECK: LV: Not vectorizing: Unsupported outer loop.
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
define void @divergent_branch(i32* nocapture %a, i32* nocapture readonly %b, i32 %N, i32 %M) local_unnamed_addr {
entry:
%cmp39 = icmp sgt i32 %N, 0
attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-source_filename = "pr33187-c.ll"
-
define void @a() {
; CHECK-LABEL: @a(
; CHECK-NEXT: b:
;; We also are testing that various variations that cause stores to move classes
;; have the right class movement happen
;; All of these tests result in verification failures if it does not.
+
+source_filename = "bugpoint-output-daef094.bc"
+target triple = "x86_64-apple-darwin16.5.0"
+
%struct.eggs = type {}
define void @spam(i32 *%a) {
br i1 undef, label %c, label %e
}
-; ModuleID = 'bugpoint-reduced-simplified.bc'
-source_filename = "bugpoint-output-daef094.bc"
-target triple = "x86_64-apple-darwin16.5.0"
-
%struct.hoge = type {}
define void @widget(%struct.hoge* %arg) {
}
declare void @quux()
-; ModuleID = 'short.ll'
-source_filename = "short.ll"
%struct.a = type {}
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
; no arrays / no nested arrays
declare i32 @printf(i8*, ...)
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
define void @call_memset(i64 %len) safestack {
entry:
; CHECK-LABEL: define void @call_memset
; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
@A = common global [1536 x float] zeroinitializer
; CHECK: polly
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @foo() {
entry: