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
|
||||
AddBitcodeToModule(const unsigned char *bitcode, int length,
|
||||
llvm::Module *module, SymbolTable *symbolTable) {
|
||||
std::string bcErr;
|
||||
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
|
||||
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);
|
||||
if (!bcModule)
|
||||
Error(SourcePos(), "Error parsing stdlib bitcode: %s", bcErr.c_str());
|
||||
else {
|
||||
#endif
|
||||
// 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
|
||||
// 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() ||
|
||||
I->hasCommonLinkage())
|
||||
Out << "extern ";
|
||||
#if defined (LLVM_3_5)
|
||||
else if (I->hasDLLImportStorageClass())
|
||||
#else
|
||||
else if (I->hasDLLImportLinkage())
|
||||
#endif
|
||||
Out << "__declspec(dllimport) ";
|
||||
else
|
||||
continue; // Internal Global
|
||||
@@ -2499,11 +2503,13 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
Out << "static ";
|
||||
else if (I->hasDLLImportLinkage())
|
||||
Out << "__declspec(dllimport) ";
|
||||
else if (I->hasDLLExportLinkage())
|
||||
Out << "__declspec(dllexport) ";
|
||||
|
||||
#if defined(LLVM_3_5)
|
||||
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||
#else
|
||||
else if (I->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
|
||||
else if (I->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
|
||||
#endif
|
||||
// Thread Local Storage
|
||||
if (I->isThreadLocal())
|
||||
Out << "__thread ";
|
||||
@@ -2782,8 +2788,13 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
bool isStructReturn = F->hasStructRetAttr();
|
||||
|
||||
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->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
|
||||
#endif
|
||||
switch (F->getCallingConv()) {
|
||||
case llvm::CallingConv::X86_StdCall:
|
||||
Out << "__attribute__((stdcall)) ";
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
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
|
||||
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 defined (LLVM_3_5)
|
||||
if (llvm::verifyFunction(*function) == true) {
|
||||
#else
|
||||
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
|
||||
#endif
|
||||
if (g->debugPrint)
|
||||
function->dump();
|
||||
FATAL("Function verificication failed");
|
||||
@@ -550,8 +554,12 @@ Function::GenerateIR() {
|
||||
emitCode(&ec, appFunction, firstStmtPos);
|
||||
if (m->errorCount == 0) {
|
||||
sym->exportedFunction = appFunction;
|
||||
#if defined(LLVM_3_5)
|
||||
if (llvm::verifyFunction(*appFunction) == true) {
|
||||
#else
|
||||
if (llvm::verifyFunction(*appFunction,
|
||||
llvm::ReturnStatusAction) == true) {
|
||||
#endif
|
||||
if (g->debugPrint)
|
||||
appFunction->dump();
|
||||
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