Merge branch 'master' into nvptx
This commit is contained in:
10
builtins.cpp
10
builtins.cpp
@@ -658,13 +658,21 @@ lSetInternalFunctions(llvm::Module *module) {
|
|||||||
void
|
void
|
||||||
AddBitcodeToModule(const unsigned char *bitcode, int length,
|
AddBitcodeToModule(const unsigned char *bitcode, int length,
|
||||||
llvm::Module *module, SymbolTable *symbolTable) {
|
llvm::Module *module, SymbolTable *symbolTable) {
|
||||||
std::string bcErr;
|
|
||||||
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
|
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
|
||||||
llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb);
|
llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb);
|
||||||
|
#if defined(LLVM_3_5)
|
||||||
|
llvm::ErrorOr<llvm::Module *> ModuleOrErr = llvm::parseBitcodeFile(bcBuf, *g->ctx);
|
||||||
|
if (llvm::error_code EC = ModuleOrErr.getError())
|
||||||
|
Error(SourcePos(), "Error parsing stdlib bitcode: %s", EC.message().c_str());
|
||||||
|
else {
|
||||||
|
llvm::Module *bcModule = ModuleOrErr.get();
|
||||||
|
#else
|
||||||
|
std::string bcErr;
|
||||||
llvm::Module *bcModule = llvm::ParseBitcodeFile(bcBuf, *g->ctx, &bcErr);
|
llvm::Module *bcModule = llvm::ParseBitcodeFile(bcBuf, *g->ctx, &bcErr);
|
||||||
if (!bcModule)
|
if (!bcModule)
|
||||||
Error(SourcePos(), "Error parsing stdlib bitcode: %s", bcErr.c_str());
|
Error(SourcePos(), "Error parsing stdlib bitcode: %s", bcErr.c_str());
|
||||||
else {
|
else {
|
||||||
|
#endif
|
||||||
// FIXME: this feels like a bad idea, but the issue is that when we
|
// FIXME: this feels like a bad idea, but the issue is that when we
|
||||||
// set the llvm::Module's target triple in the ispc Module::Module
|
// set the llvm::Module's target triple in the ispc Module::Module
|
||||||
// constructor, we start by calling llvm::sys::getHostTriple() (and
|
// constructor, we start by calling llvm::sys::getHostTriple() (and
|
||||||
|
|||||||
21
cbackend.cpp
21
cbackend.cpp
@@ -2327,7 +2327,11 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
|
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
|
||||||
I->hasCommonLinkage())
|
I->hasCommonLinkage())
|
||||||
Out << "extern ";
|
Out << "extern ";
|
||||||
|
#if defined (LLVM_3_5)
|
||||||
|
else if (I->hasDLLImportStorageClass())
|
||||||
|
#else
|
||||||
else if (I->hasDLLImportLinkage())
|
else if (I->hasDLLImportLinkage())
|
||||||
|
#endif
|
||||||
Out << "__declspec(dllimport) ";
|
Out << "__declspec(dllimport) ";
|
||||||
else
|
else
|
||||||
continue; // Internal Global
|
continue; // Internal Global
|
||||||
@@ -2499,11 +2503,13 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
|
|
||||||
if (I->hasLocalLinkage())
|
if (I->hasLocalLinkage())
|
||||||
Out << "static ";
|
Out << "static ";
|
||||||
else if (I->hasDLLImportLinkage())
|
#if defined(LLVM_3_5)
|
||||||
Out << "__declspec(dllimport) ";
|
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||||
else if (I->hasDLLExportLinkage())
|
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||||
Out << "__declspec(dllexport) ";
|
#else
|
||||||
|
else if (I->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
|
||||||
|
else if (I->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
|
||||||
|
#endif
|
||||||
// Thread Local Storage
|
// Thread Local Storage
|
||||||
if (I->isThreadLocal())
|
if (I->isThreadLocal())
|
||||||
Out << "__thread ";
|
Out << "__thread ";
|
||||||
@@ -2782,8 +2788,13 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
bool isStructReturn = F->hasStructRetAttr();
|
bool isStructReturn = F->hasStructRetAttr();
|
||||||
|
|
||||||
if (F->hasLocalLinkage()) Out << "static ";
|
if (F->hasLocalLinkage()) Out << "static ";
|
||||||
|
#if defined(LLVM_3_5)
|
||||||
|
if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||||
|
if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||||
|
#else
|
||||||
if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
|
if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
|
||||||
if (F->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
|
if (F->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
|
||||||
|
#endif
|
||||||
switch (F->getCallingConv()) {
|
switch (F->getCallingConv()) {
|
||||||
case llvm::CallingConv::X86_StdCall:
|
case llvm::CallingConv::X86_StdCall:
|
||||||
Out << "__attribute__((stdcall)) ";
|
Out << "__attribute__((stdcall)) ";
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _3D_TASKING
|
//#define _3D_TASKING //uncomment for using "3d tasking" model. This can influence performance.
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
mandel(float c_re, float c_im, int count) {
|
mandel(float c_re, float c_im, int count) {
|
||||||
|
|||||||
8
func.cpp
8
func.cpp
@@ -489,7 +489,11 @@ Function::GenerateIR() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m->errorCount == 0) {
|
if (m->errorCount == 0) {
|
||||||
|
#if defined (LLVM_3_5)
|
||||||
|
if (llvm::verifyFunction(*function) == true) {
|
||||||
|
#else
|
||||||
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
|
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
|
||||||
|
#endif
|
||||||
if (g->debugPrint)
|
if (g->debugPrint)
|
||||||
function->dump();
|
function->dump();
|
||||||
FATAL("Function verificication failed");
|
FATAL("Function verificication failed");
|
||||||
@@ -550,8 +554,12 @@ Function::GenerateIR() {
|
|||||||
emitCode(&ec, appFunction, firstStmtPos);
|
emitCode(&ec, appFunction, firstStmtPos);
|
||||||
if (m->errorCount == 0) {
|
if (m->errorCount == 0) {
|
||||||
sym->exportedFunction = appFunction;
|
sym->exportedFunction = appFunction;
|
||||||
|
#if defined(LLVM_3_5)
|
||||||
|
if (llvm::verifyFunction(*appFunction) == true) {
|
||||||
|
#else
|
||||||
if (llvm::verifyFunction(*appFunction,
|
if (llvm::verifyFunction(*appFunction,
|
||||||
llvm::ReturnStatusAction) == true) {
|
llvm::ReturnStatusAction) == true) {
|
||||||
|
#endif
|
||||||
if (g->debugPrint)
|
if (g->debugPrint)
|
||||||
appFunction->dump();
|
appFunction->dump();
|
||||||
FATAL("Function verificication failed");
|
FATAL("Function verificication failed");
|
||||||
|
|||||||
34
llvm_patches/3_3_3_4_r198267_trunc_of_select.patch
Normal file
34
llvm_patches/3_3_3_4_r198267_trunc_of_select.patch
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Index: lib/IR/ConstantFold.cpp
|
||||||
|
===================================================================
|
||||||
|
--- lib/IR/ConstantFold.cpp (revision 197981)
|
||||||
|
+++ lib/IR/ConstantFold.cpp (working copy)
|
||||||
|
@@ -705,12 +705,23 @@
|
||||||
|
SmallVector<Constant*, 16> Result;
|
||||||
|
Type *Ty = IntegerType::get(CondV->getContext(), 32);
|
||||||
|
for (unsigned i = 0, e = V1->getType()->getVectorNumElements(); i != e;++i){
|
||||||
|
- ConstantInt *Cond = dyn_cast<ConstantInt>(CondV->getOperand(i));
|
||||||
|
- if (Cond == 0) break;
|
||||||
|
-
|
||||||
|
- Constant *V = Cond->isNullValue() ? V2 : V1;
|
||||||
|
- Constant *Res = ConstantExpr::getExtractElement(V, ConstantInt::get(Ty, i));
|
||||||
|
- Result.push_back(Res);
|
||||||
|
+ Constant *V;
|
||||||
|
+ Constant *V1Element = ConstantExpr::getExtractElement(V1,
|
||||||
|
+ ConstantInt::get(Ty, i));
|
||||||
|
+ Constant *V2Element = ConstantExpr::getExtractElement(V2,
|
||||||
|
+ ConstantInt::get(Ty, i));
|
||||||
|
+ Constant *Cond = dyn_cast<Constant>(CondV->getOperand(i));
|
||||||
|
+ if (V1Element == V2Element) {
|
||||||
|
+ V = V1Element;
|
||||||
|
+ }
|
||||||
|
+ else if (isa<UndefValue>(Cond)) {
|
||||||
|
+ V = isa<UndefValue>(V1Element) ? V1Element : V2Element;
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ if (!isa<ConstantInt>(Cond)) break;
|
||||||
|
+ V = Cond->isNullValue() ? V2Element : V1Element;
|
||||||
|
+ }
|
||||||
|
+ Result.push_back(V);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we were able to build the vector, return it.
|
||||||
Reference in New Issue
Block a user