Commit 6fcbdddb by Karl Schimpf

Disable Subzero IR generation for performance testing.

This CL allows one to time Subzero's bitcode parsing without IR generation (other than types, function declarations, and uninitialized global variables) for performance testing. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/696383004
parent 0faec4c9
...@@ -51,10 +51,12 @@ CXX_DEFINES = ...@@ -51,10 +51,12 @@ CXX_DEFINES =
ifdef MINIMAL ifdef MINIMAL
OBJDIR := $(OBJDIR)+Min OBJDIR := $(OBJDIR)+Min
CXX_DEFINES += -DALLOW_TEXT_ASM=0 -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 \ CXX_DEFINES += -DALLOW_TEXT_ASM=0 -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 \
-DALLOW_LLVM_IR=0 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_LLVM_IR=0 -DALLOW_LLVM_IR_AS_INPUT=0 \
-DALLOW_DISABLE_IR_GEN=0
else else
CXX_DEFINES += -DALLOW_TEXT_ASM=1 -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 \ CXX_DEFINES += -DALLOW_TEXT_ASM=1 -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 \
-DALLOW_LLVM_IR=1 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_LLVM_IR=1 -DALLOW_LLVM_IR_AS_INPUT=1 \
-DALLOW_DISABLE_IR_GEN=1
endif endif
ifdef NOASSERT ifdef NOASSERT
......
...@@ -47,6 +47,7 @@ def main(): ...@@ -47,6 +47,7 @@ def main():
action='store_true', action='store_true',
help='Trace command that generates ICE instructions') help='Trace command that generates ICE instructions')
argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
default=[],
help='Remaining arguments are passed to llvm2ice') help='Remaining arguments are passed to llvm2ice')
args = argparser.parse_args() args = argparser.parse_args()
...@@ -78,7 +79,6 @@ def main(): ...@@ -78,7 +79,6 @@ def main():
cmd += ['--build-on-read=0'] cmd += ['--build-on-read=0']
else: else:
cmd += ['--build-on-read=1'] cmd += ['--build-on-read=1']
if args.args:
cmd += args.args cmd += args.args
if args.llvm_source: if args.llvm_source:
cmd += [llfile] cmd += [llfile]
......
...@@ -31,7 +31,10 @@ Cfg::Cfg(GlobalContext *Ctx) ...@@ -31,7 +31,10 @@ Cfg::Cfg(GlobalContext *Ctx)
VMetadata(new VariablesMetadata(this)), VMetadata(new VariablesMetadata(this)),
TargetAssembler( TargetAssembler(
TargetLowering::createAssembler(Ctx->getTargetArch(), this)), TargetLowering::createAssembler(Ctx->getTargetArch(), this)),
CurrentNode(NULL) {} CurrentNode(NULL) {
assert(!Ctx->isIRGenerationDisabled() &&
"Attempt to build cfg when IR generation disabled");
}
Cfg::~Cfg() {} Cfg::~Cfg() {}
......
...@@ -26,8 +26,9 @@ public: ...@@ -26,8 +26,9 @@ public:
UseIntegratedAssembler(false), UseSandboxing(false), UseIntegratedAssembler(false), UseSandboxing(false),
PhiEdgeSplit(false), DecorateAsm(false), DumpStats(false), PhiEdgeSplit(false), DecorateAsm(false), DumpStats(false),
AllowUninitializedGlobals(false), TimeEachFunction(false), AllowUninitializedGlobals(false), TimeEachFunction(false),
DefaultGlobalPrefix(""), DefaultFunctionPrefix(""), TimingFocusOn(""), DisableIRGeneration(false), DefaultGlobalPrefix(""),
VerboseFocusOn(""), TranslateOnly("") {} DefaultFunctionPrefix(""), TimingFocusOn(""), VerboseFocusOn(""),
TranslateOnly("") {}
bool DisableInternal; bool DisableInternal;
bool SubzeroTimingEnabled; bool SubzeroTimingEnabled;
bool DisableTranslation; bool DisableTranslation;
...@@ -40,6 +41,7 @@ public: ...@@ -40,6 +41,7 @@ public:
bool DumpStats; bool DumpStats;
bool AllowUninitializedGlobals; bool AllowUninitializedGlobals;
bool TimeEachFunction; bool TimeEachFunction;
bool DisableIRGeneration;
IceString DefaultGlobalPrefix; IceString DefaultGlobalPrefix;
IceString DefaultFunctionPrefix; IceString DefaultFunctionPrefix;
IceString TimingFocusOn; IceString TimingFocusOn;
......
...@@ -140,6 +140,10 @@ public: ...@@ -140,6 +140,10 @@ public:
const ClFlags &getFlags() const { return Flags; } const ClFlags &getFlags() const { return Flags; }
bool isIRGenerationDisabled() const {
return ALLOW_DISABLE_IR_GEN ? getFlags().DisableIRGeneration : false;
}
// Allocate data of type T using the global allocator. // Allocate data of type T using the global allocator.
template <typename T> T *allocate() { return Allocator.Allocate<T>(); } template <typename T> T *allocate() { return Allocator.Allocate<T>(); }
......
...@@ -137,6 +137,8 @@ class ConstantPrimitive : public Constant { ...@@ -137,6 +137,8 @@ class ConstantPrimitive : public Constant {
public: public:
static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value, static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value,
uint32_t PoolEntryID) { uint32_t PoolEntryID) {
assert(!Ctx->isIRGenerationDisabled() &&
"Attempt to build primitive constant when IR generation disabled");
return new (Ctx->allocate<ConstantPrimitive>()) return new (Ctx->allocate<ConstantPrimitive>())
ConstantPrimitive(Ty, Value, PoolEntryID); ConstantPrimitive(Ty, Value, PoolEntryID);
} }
...@@ -206,6 +208,8 @@ public: ...@@ -206,6 +208,8 @@ public:
static ConstantRelocatable *create(GlobalContext *Ctx, Type Ty, static ConstantRelocatable *create(GlobalContext *Ctx, Type Ty,
const RelocatableTuple &Tuple, const RelocatableTuple &Tuple,
uint32_t PoolEntryID) { uint32_t PoolEntryID) {
assert(!Ctx->isIRGenerationDisabled() &&
"Attempt to build relocatable constant when IR generation disabled");
return new (Ctx->allocate<ConstantRelocatable>()) ConstantRelocatable( return new (Ctx->allocate<ConstantRelocatable>()) ConstantRelocatable(
Ty, Tuple.Offset, Tuple.Name, Tuple.SuppressMangling, PoolEntryID); Ty, Tuple.Offset, Tuple.Name, Tuple.SuppressMangling, PoolEntryID);
} }
...@@ -246,6 +250,8 @@ class ConstantUndef : public Constant { ...@@ -246,6 +250,8 @@ class ConstantUndef : public Constant {
public: public:
static ConstantUndef *create(GlobalContext *Ctx, Type Ty, static ConstantUndef *create(GlobalContext *Ctx, Type Ty,
uint32_t PoolEntryID) { uint32_t PoolEntryID) {
assert(!Ctx->isIRGenerationDisabled() &&
"Attempt to build undefined constant when IR generation disabled");
return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID); return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID);
} }
......
...@@ -94,6 +94,10 @@ DisableInternal("externalize", ...@@ -94,6 +94,10 @@ DisableInternal("externalize",
cl::desc("Externalize all symbols")); cl::desc("Externalize all symbols"));
static cl::opt<bool> static cl::opt<bool>
DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); DisableTranslation("notranslate", cl::desc("Disable Subzero translation"));
// Note: Modifiable only if ALLOW_DISABLE_IR_GEN.
static cl::opt<bool>
DisableIRGeneration("no-ir-gen",
cl::desc("Disable generating Subzero IR."));
static cl::opt<std::string> static cl::opt<std::string>
TranslateOnly("translate-only", cl::desc("Translate only the given function"), TranslateOnly("translate-only", cl::desc("Translate only the given function"),
cl::init("")); cl::init(""));
...@@ -188,12 +192,12 @@ static int GetReturnValue(int Val) { ...@@ -188,12 +192,12 @@ static int GetReturnValue(int Val) {
static struct { static struct {
const char *FlagName; const char *FlagName;
int FlagValue; int FlagValue;
} ConditionalBuildAttributes[] = { { "text_asm", ALLOW_TEXT_ASM }, } ConditionalBuildAttributes[] = {{"text_asm", ALLOW_TEXT_ASM},
{ "dump", ALLOW_DUMP }, {"dump", ALLOW_DUMP},
{ "llvm_cl", ALLOW_LLVM_CL }, {"llvm_cl", ALLOW_LLVM_CL},
{ "llvm_ir", ALLOW_LLVM_IR }, {"llvm_ir", ALLOW_LLVM_IR},
{ "llvm_ir_as_input", {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT},
ALLOW_LLVM_IR_AS_INPUT } }; {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}};
// Validates values of build attributes. Prints them to Stream if // Validates values of build attributes. Prints them to Stream if
// Stream is non-null. // Stream is non-null.
...@@ -228,6 +232,9 @@ int main(int argc, char **argv) { ...@@ -228,6 +232,9 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv); cl::ParseCommandLineOptions(argc, argv);
if (DisableIRGeneration)
DisableTranslation = true;
Ice::VerboseMask VMask = Ice::IceV_None; Ice::VerboseMask VMask = Ice::IceV_None;
for (unsigned i = 0; i != VerboseList.size(); ++i) for (unsigned i = 0; i != VerboseList.size(); ++i)
VMask |= VerboseList[i]; VMask |= VerboseList[i];
...@@ -251,6 +258,12 @@ int main(int argc, char **argv) { ...@@ -251,6 +258,12 @@ int main(int argc, char **argv) {
raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs);
Ls->SetUnbuffered(); Ls->SetUnbuffered();
if (!ALLOW_DISABLE_IR_GEN && DisableIRGeneration) {
*Ls << "Error: Build doesn't allow --no-ir-gen when not "
<< "ALLOW_DISABLE_IR_GEN!\n";
return GetReturnValue(1);
}
Ice::ClFlags Flags; Ice::ClFlags Flags;
Flags.DisableInternal = DisableInternal; Flags.DisableInternal = DisableInternal;
Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; Flags.SubzeroTimingEnabled = SubzeroTimingEnabled;
...@@ -269,6 +282,7 @@ int main(int argc, char **argv) { ...@@ -269,6 +282,7 @@ int main(int argc, char **argv) {
Flags.TimingFocusOn = TimingFocusOn; Flags.TimingFocusOn = TimingFocusOn;
Flags.VerboseFocusOn = VerboseFocusOn; Flags.VerboseFocusOn = VerboseFocusOn;
Flags.TranslateOnly = TranslateOnly; Flags.TranslateOnly = TranslateOnly;
Flags.DisableIRGeneration = DisableIRGeneration;
Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix,
Flags); Flags);
......
...@@ -79,8 +79,7 @@ def if_cond_flag(Value): ...@@ -79,8 +79,7 @@ def if_cond_flag(Value):
# shell conditional commands. # shell conditional commands.
if_atts = [os.path.join(pydir, 'if.py')] if_atts = [os.path.join(pydir, 'if.py')]
if_atts_cmd = if_atts + ['--have=' + att if_atts_cmd = if_atts + ['--have=' + att for att in llvm2iceatts]
for att in llvm2iceatts] + ['--command']
ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts), ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts),
'--command'] '--command']
iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input' iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input'
......
; Test if we can read alloca instructions. ; Test if we can read alloca instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
; Show examples where size is defined by a constant. ; Show examples where size is defined by a constant.
...@@ -159,3 +163,5 @@ entry: ...@@ -159,3 +163,5 @@ entry:
; CHECK-NEXT: %array = alloca i8, i32 %n, align 16 ; CHECK-NEXT: %array = alloca i8, i32 %n, align 16
; CHECK-NEXT: ret i32 %array ; CHECK-NEXT: ret i32 %array
} }
; NOIR: Total across all functions
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %l2i -i %s --insts | %ifl FileCheck %s ; RUN: %l2i -i %s --insts | %ifl FileCheck %s
; RUN: %lc2i -i %s --insts | %iflc FileCheck %s ; RUN: %lc2i -i %s --insts | %iflc FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
; TODO(kschimpf): add i8/i16. Needs bitcasts. ; TODO(kschimpf): add i8/i16. Needs bitcasts.
...@@ -965,3 +969,5 @@ entry: ...@@ -965,3 +969,5 @@ entry:
; CHECK-NEXT: %lshr = lshr <4 x i32> %b, %a ; CHECK-NEXT: %lshr = lshr <4 x i32> %b, %a
; CHECK-NEXT: ret <4 x i32> %lshr ; CHECK-NEXT: ret <4 x i32> %lshr
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Tests if we handle a branch instructions. ; Tests if we handle a branch instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @SimpleBranch() { define void @SimpleBranch() {
entry: entry:
...@@ -43,3 +47,5 @@ b2: ...@@ -43,3 +47,5 @@ b2:
; CHECK-NEXT: b2: ; CHECK-NEXT: b2:
; CHECK-NEXT: br i1 %test, label %b2, label %b1 ; CHECK-NEXT: br i1 %test, label %b2, label %b1
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test parsing indirect calls in Subzero. ; Test parsing indirect calls in Subzero.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define internal void @CallIndirectVoid(i32 %f_addr) { define internal void @CallIndirectVoid(i32 %f_addr) {
entry: entry:
...@@ -27,3 +31,5 @@ entry: ...@@ -27,3 +31,5 @@ entry:
; CHECK-NEXT: %r = call i32 %f_addr(i8 1, i1 false) ; CHECK-NEXT: %r = call i32 %f_addr(i8 1, i1 false)
; CHECK-NEXT: ret i32 %r ; CHECK-NEXT: ret i32 %r
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test handling of call instructions. ; Test handling of call instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define i32 @fib(i32 %n) { define i32 @fib(i32 %n) {
entry: entry:
...@@ -106,3 +110,4 @@ if.end: ; preds = %if.then, %entry ...@@ -106,3 +110,4 @@ if.end: ; preds = %if.then, %entry
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Tests if we can read cast operations. ; Tests if we can read cast operations.
; RUN: %p2i -i %s --insts --no-local-syms | FileCheck %s ; RUN: %p2i -i %s --insts --no-local-syms | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
; TODO(kschimpf) Find way to test pointer conversions (since they in general ; TODO(kschimpf) Find way to test pointer conversions (since they in general
; get removed by pnacl-freeze). ; get removed by pnacl-freeze).
...@@ -532,3 +536,5 @@ define void @BitcastV16xi8(<16 x i8> %v) { ...@@ -532,3 +536,5 @@ define void @BitcastV16xi8(<16 x i8> %v) {
; CHECK-NEXT: %__3 = bitcast <16 x i8> %__0 to <8 x i16> ; CHECK-NEXT: %__3 = bitcast <16 x i8> %__0 to <8 x i16>
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test if we can read compare instructions. ; Test if we can read compare instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define i1 @IcmpI1(i32 %p1, i32 %p2) { define i1 @IcmpI1(i32 %p1, i32 %p2) {
entry: entry:
...@@ -469,3 +473,5 @@ entry: ...@@ -469,3 +473,5 @@ entry:
; CHECK-NEXT: %vtrue = fcmp true <4 x float> %a1, %a2 ; CHECK-NEXT: %vtrue = fcmp true <4 x float> %a1, %a2
; CHECK-NEXT: ret <4 x i1> %voeq ; CHECK-NEXT: ret <4 x i1> %voeq
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test handling of constants in function blocks. ; Test handling of constants in function blocks.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @TestIntegers() { define void @TestIntegers() {
entry: entry:
...@@ -152,3 +156,5 @@ entry: ...@@ -152,3 +156,5 @@ entry:
ret void ret void
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
} }
; NOIR: Total across all functions
; Test use forward type references in function blocks. ; Test use forward type references in function blocks.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: llvm-as < %s | pnacl-freeze | pnacl-bcdis -no-records \ ; RUN: llvm-as < %s | pnacl-freeze | pnacl-bcdis -no-records \
; RUN: | FileCheck --check-prefix=DUMP %s ; RUN: | FileCheck --check-prefix=DUMP %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @LoopCarriedDep() { define void @LoopCarriedDep() {
b0: b0:
...@@ -116,3 +119,5 @@ b6: ...@@ -116,3 +119,5 @@ b6:
; DUMP-NEXT: %b6: ; DUMP-NEXT: %b6:
; DUMP-NEXT: ret void; <@a3> ; DUMP-NEXT: ret void; <@a3>
; DUMP-NEXT: } ; DUMP-NEXT: }
; NOIR: Total across all functions
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %l2i -i %s --insts | %ifl FileCheck %s ; RUN: %l2i -i %s --insts | %ifl FileCheck %s
; RUN: %lc2i -i %s --insts | %iflc FileCheck %s ; RUN: %lc2i -i %s --insts | %iflc FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
@PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4
; CHECK: @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 ; CHECK: @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4
...@@ -74,3 +78,5 @@ entry: ...@@ -74,3 +78,5 @@ entry:
%result = sub i32 0, %size %result = sub i32 0, %size
ret i32 %result ret i32 %result
} }
; NOIR: Total across all functions
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %l2i -i %s --insts | %ifl FileCheck %s ; RUN: %l2i -i %s --insts | %ifl FileCheck %s
; RUN: %lc2i -i %s --insts | %iflc FileCheck %s ; RUN: %lc2i -i %s --insts | %iflc FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
@bytes = internal global [7 x i8] c"abcdefg" @bytes = internal global [7 x i8] c"abcdefg"
; CHECK: @bytes = internal global [7 x i8] c"abcdefg" ; CHECK: @bytes = internal global [7 x i8] c"abcdefg"
...@@ -95,3 +99,4 @@ define void @func() { ...@@ -95,3 +99,4 @@ define void @func() {
; CHECK-NEXT: define void @func() { ; CHECK-NEXT: define void @func() {
; NOIR: Total across all functions
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %l2i -i %s --insts | %ifl FileCheck %s ; RUN: %l2i -i %s --insts | %ifl FileCheck %s
; RUN: %lc2i -i %s --insts | %iflc FileCheck %s ; RUN: %lc2i -i %s --insts | %iflc FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @ExtractV4xi1(<4 x i1> %v) { define void @ExtractV4xi1(<4 x i1> %v) {
entry: entry:
...@@ -377,3 +381,5 @@ entry: ...@@ -377,3 +381,5 @@ entry:
; CHECK-NEXT: %r3 = insertelement <4 x float> %v, float %e, i32 3 ; CHECK-NEXT: %r3 = insertelement <4 x float> %v, float %e, i32 3
; CHECK-NEXT: ret <4 x float> %r3 ; CHECK-NEXT: ret <4 x float> %r3
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test if we can read load instructions. ; Test if we can read load instructions.
; RUN: %p2i --no-local-syms -i %s --insts | FileCheck %s ; RUN: %p2i --no-local-syms -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define i32 @load_i8(i32 %addr) { define i32 @load_i8(i32 %addr) {
entry: entry:
...@@ -144,3 +148,4 @@ entry: ...@@ -144,3 +148,4 @@ entry:
; CHECK-NEXT: ret <4 x float> %__1 ; CHECK-NEXT: ret <4 x float> %__1
} }
; NOIR: Total across all functions
; Test parsing NaCl atomic instructions. ; Test parsing NaCl atomic instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
declare i8 @llvm.nacl.atomic.load.i8(i8*, i32) declare i8 @llvm.nacl.atomic.load.i8(i8*, i32)
declare i16 @llvm.nacl.atomic.load.i16(i16*, i32) declare i16 @llvm.nacl.atomic.load.i16(i16*, i32)
...@@ -638,3 +642,4 @@ entry: ...@@ -638,3 +642,4 @@ entry:
; CHECK-NEXT: ret i32 %r ; CHECK-NEXT: ret i32 %r
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; This tests parsing NaCl intrinsics not related to atomic operations. ; This tests parsing NaCl intrinsics not related to atomic operations.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
declare i8* @llvm.nacl.read.tp() declare i8* @llvm.nacl.read.tp()
declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
...@@ -339,3 +343,4 @@ entry: ...@@ -339,3 +343,4 @@ entry:
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test reading phi instructions. ; Test reading phi instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
; TODO(kschimpf) Add forward reference examples. ; TODO(kschimpf) Add forward reference examples.
...@@ -28,3 +32,4 @@ target: ...@@ -28,3 +32,4 @@ target:
; CHECK-NEXT: ret i32 %result ; CHECK-NEXT: ret i32 %result
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Tests if we can read select instructions. ; Tests if we can read select instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @Seli1(i32 %p) { define void @Seli1(i32 %p) {
entry: entry:
...@@ -293,3 +297,5 @@ entry: ...@@ -293,3 +297,5 @@ entry:
; CHECK-NEXT: %r = select <4 x i1> %pc, <4 x float> %pt, <4 x float> %pe ; CHECK-NEXT: %r = select <4 x i1> %pc, <4 x float> %pt, <4 x float> %pe
; CHECK-NEXT: ret <4 x float> %r ; CHECK-NEXT: ret <4 x float> %r
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
; Test if we can read store instructions. ; Test if we can read store instructions.
; RUN: %p2i -i %s --insts --no-local-syms | FileCheck %s ; RUN: %p2i -i %s --insts --no-local-syms | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @store_i8(i32 %addr) { define void @store_i8(i32 %addr) {
entry: entry:
...@@ -133,3 +137,5 @@ define void @store_v4xFloat(i32 %addr, <4 x float> %v) { ...@@ -133,3 +137,5 @@ define void @store_v4xFloat(i32 %addr, <4 x float> %v) {
; CHECK-NEXT: store <4 x float> %__1, <4 x float>* %__0, align 4 ; CHECK-NEXT: store <4 x float> %__1, <4 x float>* %__0, align 4
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
} }
; NOIR: Total across all functions
; Test switch instructions. ; Test switch instructions.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define void @testDefaultSwitch(i32 %a) { define void @testDefaultSwitch(i32 %a) {
entry: entry:
...@@ -490,3 +494,4 @@ exit: ...@@ -490,3 +494,4 @@ exit:
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
; RUN: -default-function-prefix=h -default-global-prefix=g \ ; RUN: -default-function-prefix=h -default-global-prefix=g \
; RUN: | FileCheck --check-prefix=BAD %s ; RUN: | FileCheck --check-prefix=BAD %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
; TODO(kschimpf) Check global variable declarations, once generated. ; TODO(kschimpf) Check global variable declarations, once generated.
@0 = internal global [4 x i8] zeroinitializer, align 4 @0 = internal global [4 x i8] zeroinitializer, align 4
...@@ -57,3 +62,5 @@ define void @h5() { ...@@ -57,3 +62,5 @@ define void @h5() {
; BAD: Warning : Default global prefix 'g' potentially conflicts with name 'g'. ; BAD: Warning : Default global prefix 'g' potentially conflicts with name 'g'.
; BAD: Warning : Default function prefix 'h' potentially conflicts with name 'h5'. ; BAD: Warning : Default function prefix 'h' potentially conflicts with name 'h5'.
; NOIR: Total across all functions
; Test parsing unreachable instruction. ; Test parsing unreachable instruction.
; RUN: %p2i -i %s --insts | FileCheck %s ; RUN: %p2i -i %s --insts | FileCheck %s
; RUN: %if --need=allow_disable_ir_gen --command \
; RUN: %p2i -i %s --args -notranslate -timing -no-ir-gen \
; RUN: | %if --need=allow_disable_ir_gen --command \
; RUN: FileCheck --check-prefix=NOIR %s
define internal i32 @divide(i32 %num, i32 %den) { define internal i32 @divide(i32 %num, i32 %den) {
entry: entry:
...@@ -25,3 +29,5 @@ return: ; preds = %entry ...@@ -25,3 +29,5 @@ return: ; preds = %entry
; CHECK-NEXT: %div = sdiv i32 %num, %den ; CHECK-NEXT: %div = sdiv i32 %num, %den
; CHECK-NEXT: ret i32 %div ; CHECK-NEXT: ret i32 %div
; CHECK-NEXT: } ; CHECK-NEXT: }
; NOIR: Total across all functions
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment