Removed dirty workaround that fixed 'soa-18.ispc' test. It broke badly in a different scenario

This commit is contained in:
Anton Mitrokhin
2015-09-30 17:20:38 +03:00
parent 8bf8911893
commit 68e686df9f

View File

@@ -4186,27 +4186,29 @@ void CWriter::visitCallInst(llvm::CallInst &I) {
Callee->getName() == "_aligned_malloc") Callee->getName() == "_aligned_malloc")
Out << "(uint8_t *)"; Out << "(uint8_t *)";
if (Callee->getName() == "__masked_store_i64") { // This 'if' will fix 'soa-18.ispc' test (fails with optimizations off)
llvm::CallSite CS(&I); // Yet the way the case is fixed is quite dirty and leads to many other fails
llvm::CallSite::arg_iterator AI = CS.arg_begin();
if (is_vec16_i64_ty(llvm::cast<llvm::PointerType>((*AI)->getType())->getElementType())) { //if (Callee->getName() == "__masked_store_i64") {
Out << "/* Replacing store of vec16_i64 val into &vec16_i64 pointer with a simple copy */\n"; // llvm::CallSite CS(&I);
// If we are trying to get a pointer to from a vec16_i64 var // llvm::CallSite::arg_iterator AI = CS.arg_begin();
// It would be better to replace this instruction with a masked copy // if (is_vec16_i64_ty(llvm::cast<llvm::PointerType>((*AI)->getType())->getElementType())) {
if (llvm::isa<llvm::GetElementPtrInst>(*AI)) { // Out << "/* Replacing store of vec16_i64 val into &vec16_i64 pointer with a simple copy */\n";
writeOperandDeref(*AI); // // If we are trying to get a pointer to from a vec16_i64 var
Out << " = __select("; // // It would be better to replace this instruction with a masked copy
writeOperand(*(AI+2)); // if (llvm::isa<llvm::GetElementPtrInst>(*AI)) {
Out << ", "; // writeOperandDeref(*AI);
writeOperand(*(AI+1)); // Out << " = __select(";
Out << ", "; // writeOperand(*(AI+2));
writeOperandDeref(*AI); // Out << ", ";
Out << ")"; // writeOperand(*(AI+1));
return; // Out << ", ";
} // writeOperandDeref(*AI);
} // Out << ")";
} // return;
// }
// }
//}
if (NeedsCast) { if (NeedsCast) {
// Ok, just cast the pointer type. // Ok, just cast the pointer type.