2019-04-17 12:52:47 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
|
|
; RUN: opt -newgvn -S %s | FileCheck %s
|
|
|
|
; Ensure that loads that bypass memory def-use chains get added as users of the new
|
|
|
|
; MemoryDef. Otherwise this test will not pass memory verification because the value
|
|
|
|
; of the load will not be reprocessed until verification.
|
|
|
|
; ModuleID = 'bugpoint-reduced-simplified.bc'
|
|
|
|
source_filename = "bugpoint-output-f242c4f.bc"
|
|
|
|
target triple = "x86_64-apple-darwin16.7.0"
|
|
|
|
|
|
|
|
@global = external global i32 #0
|
|
|
|
@global.1 = external global i32 #0
|
|
|
|
|
|
|
|
define void @hoge(i32 %arg) {
|
|
|
|
; CHECK-LABEL: @hoge(
|
|
|
|
; CHECK-NEXT: bb:
|
|
|
|
; CHECK-NEXT: br label [[BB2:%.*]]
|
|
|
|
; CHECK: bb1:
|
|
|
|
; CHECK-NEXT: br label [[BB2]]
|
|
|
|
; CHECK: bb2:
|
|
|
|
; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ 0, [[BB1:%.*]] ], [ [[ARG:%.*]], [[BB:%.*]] ]
|
|
|
|
; CHECK-NEXT: br label [[BB6:%.*]]
|
|
|
|
; CHECK: bb3:
|
Infer alignment of unmarked loads in IR/bitcode parsing.
For IR generated by a compiler, this is really simple: you just take the
datalayout from the beginning of the file, and apply it to all the IR
later in the file. For optimization testcases that don't care about the
datalayout, this is also really simple: we just use the default
datalayout.
The complexity here comes from the fact that some LLVM tools allow
overriding the datalayout: some tools have an explicit flag for this,
some tools will infer a datalayout based on the code generation target.
Supporting this properly required plumbing through a bunch of new
machinery: we want to allow overriding the datalayout after the
datalayout is parsed from the file, but before we use any information
from it. Therefore, IR/bitcode parsing now has a callback to allow tools
to compute the datalayout at the appropriate time.
Not sure if I covered all the LLVM tools that want to use the callback.
(clang? lli? Misc IR manipulation tools like llvm-link?). But this is at
least enough for all the LLVM regression tests, and IR without a
datalayout is not something frontends should generate.
This change had some sort of weird effects for certain CodeGen
regression tests: if the datalayout is overridden with a datalayout with
a different program or stack address space, we now parse IR based on the
overridden datalayout, instead of the one written in the file (or the
default one, if none is specified). This broke a few AVR tests, and one
AMDGPU test.
Outside the CodeGen tests I mentioned, the test changes are all just
fixing CHECK lines and moving around datalayout lines in weird places.
Differential Revision: https://reviews.llvm.org/D78403
2020-05-15 03:59:45 +08:00
|
|
|
; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* @global, align 4, !h !0
|
2019-04-17 12:52:47 +08:00
|
|
|
; CHECK-NEXT: unreachable
|
|
|
|
; CHECK: bb6:
|
2020-05-15 05:48:10 +08:00
|
|
|
; CHECK-NEXT: store i32 [[TMP]], i32* @global.1, align 4, !h !0
|
2019-04-17 12:52:47 +08:00
|
|
|
; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB1]]
|
|
|
|
; CHECK: bb7:
|
|
|
|
; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB8:%.*]]
|
|
|
|
; CHECK: bb8:
|
|
|
|
; CHECK-NEXT: br i1 false, label [[BB9:%.*]], label [[BB3:%.*]]
|
|
|
|
; CHECK: bb9:
|
2020-05-15 05:48:10 +08:00
|
|
|
; CHECK-NEXT: store i8 undef, i8* null, align 1
|
2019-04-17 12:52:47 +08:00
|
|
|
; CHECK-NEXT: br label [[BB3]]
|
|
|
|
; CHECK: bb10:
|
2020-05-15 05:48:10 +08:00
|
|
|
; CHECK-NEXT: store i32 0, i32* @global, align 4, !h !0
|
2019-04-17 12:52:47 +08:00
|
|
|
; CHECK-NEXT: br label [[BB7]]
|
|
|
|
;
|
|
|
|
bb:
|
|
|
|
br label %bb2
|
|
|
|
|
|
|
|
bb1: ; preds = %bb6
|
|
|
|
br label %bb2
|
|
|
|
|
|
|
|
bb2: ; preds = %bb1, %bb
|
|
|
|
%tmp = phi i32 [ 0, %bb1 ], [ %arg, %bb ]
|
|
|
|
br label %bb6
|
|
|
|
|
|
|
|
bb3: ; preds = %bb9, %bb8
|
|
|
|
%tmp4 = load i32, i32* @global, !h !0
|
|
|
|
%tmp5 = icmp eq i32 %tmp4, 0
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
bb6: ; preds = %bb2
|
|
|
|
store i32 %tmp, i32* @global.1, !h !0
|
|
|
|
br i1 undef, label %bb7, label %bb1
|
|
|
|
|
|
|
|
bb7: ; preds = %bb10, %bb6
|
|
|
|
br i1 undef, label %bb10, label %bb8
|
|
|
|
|
|
|
|
bb8: ; preds = %bb7
|
|
|
|
br i1 false, label %bb9, label %bb3
|
|
|
|
|
|
|
|
bb9: ; preds = %bb8
|
|
|
|
call void @widget()
|
|
|
|
br label %bb3
|
|
|
|
|
|
|
|
bb10: ; preds = %bb7
|
|
|
|
store i32 0, i32* @global, !h !0
|
|
|
|
br label %bb7
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @widget()
|
|
|
|
|
|
|
|
attributes #0 = { align=4 }
|
|
|
|
|
|
|
|
!0 = !{}
|