Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions test/addrspacecast_null.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv %s -o %t.spv
; RUN: spirv-dis %t.spv | FileCheck %s

; Test that addrspacecast of null pointer generates appropriate OpConstantNull
Expand Down
3 changes: 1 addition & 2 deletions test/align-duplicate.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv %s -o %t.spv
; RUN: spirv-val %t.spv

; Test that duplicate align information does not result in SPIR-V validation
Expand Down
9 changes: 4 additions & 5 deletions test/array-alloca.ll
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv %s -o %t.spv

; Validation test.
; RUN: spirv-val %t.spv

; SPIR-V codegen test.
; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %s -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV

; Roundtrip test.
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM

; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: llvm-spirv %s -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: spirv-val %t.spv
; RUN: llvm-spirv %t.bc -spirv-text --spirv-ext=+SPV_KHR_untyped_pointers -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %s -spirv-text --spirv-ext=+SPV_KHR_untyped_pointers -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
Expand Down
1 change: 1 addition & 0 deletions tools/llvm-spirv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
BitReader
BitWriter
Core
IRReader
Passes
Support
TargetParser
Expand Down
16 changes: 10 additions & 6 deletions tools/llvm-spirv/llvm-spirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
Expand All @@ -62,6 +62,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/raw_ostream.h"

Expand Down Expand Up @@ -375,11 +376,14 @@ class StreambufToArray : public std::streambuf {
static int convertLLVMToSPIRV(const SPIRV::TranslatorOpts &Opts) {
LLVMContext Context;

std::unique_ptr<MemoryBuffer> MB =
ExitOnErr(errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputFile)));
std::unique_ptr<Module> M =
ExitOnErr(getOwningLazyBitcodeModule(std::move(MB), Context,
/*ShouldLazyLoadMetadata=*/true));
SMDiagnostic GetIRErr;
std::unique_ptr<Module> M = getLazyIRFileModule(
InputFile, GetIRErr, Context, /*ShouldLazyLoadMetadata=*/true);
if (!M) {
ExitOnErr(
createStringError(inconvertibleErrorCode(), GetIRErr.getMessage()));
}

ExitOnErr(M->materializeAll());

if (OutputFile.empty()) {
Expand Down
Loading