Merge pull request #964 from ncos/cbackend-opbc

fix for broken i32/64 to vec1_i32/64 bitcast
This commit is contained in:
Dmitry Babokin
2015-02-19 13:21:18 +03:00
2 changed files with 5 additions and 89 deletions

View File

@@ -3635,6 +3635,11 @@ void CWriter::visitCastInst(llvm::CastInst &I) {
return; return;
} }
if ((llvm::isa<llvm::VectorType>(DstTy)) && (!llvm::isa<llvm::VectorType>(SrcTy))) {
writeOperand(I.getOperand(0));
return;
}
Out << '('; Out << '(';
bool closeParen = printCast(I.getOpcode(), SrcTy, DstTy); bool closeParen = printCast(I.getOpcode(), SrcTy, DstTy);
@@ -4740,54 +4745,6 @@ SmearCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
} }
///////////////////////////////////////////////////////////////////////////
// BitcastCleanupPass
class BitcastCleanupPass : public llvm::BasicBlockPass {
public:
BitcastCleanupPass()
: BasicBlockPass(ID) { }
const char *getPassName() const { return "Bitcast Cleanup Pass"; }
bool runOnBasicBlock(llvm::BasicBlock &BB);
static char ID;
};
char BitcastCleanupPass::ID = 0;
bool
BitcastCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
bool modifiedAny = false;
restart:
for (llvm::BasicBlock::iterator iter = bb.begin(), e = bb.end(); iter != e; ++iter) {
llvm::BitCastInst *bc = llvm::dyn_cast<llvm::BitCastInst>(&*iter);
if (bc == NULL)
continue;
// We only care about bitcasts from integer types to vector types
if (!llvm::isa<llvm::VectorType>(bc->getType()))
continue;
llvm::Value *Op = bc->getOperand(0);
if (llvm::isa<llvm::VectorType>(Op->getType()))
continue;
llvm::BitCastInst *opBc = llvm::dyn_cast<llvm::BitCastInst>(Op);
if (opBc == NULL) Op->dump();
assert(opBc != NULL);
assert(llvm::isa<llvm::VectorType>(opBc->getOperand(0)->getType()));
llvm::Instruction *newBitCast = new llvm::BitCastInst(opBc->getOperand(0), bc->getType(),
"replacement_bc", (llvm::Instruction *)NULL);
ReplaceInstWithInst(iter, newBitCast);
modifiedAny = true;
goto restart;
}
return modifiedAny;
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// AndCmpCleanupPass // AndCmpCleanupPass
@@ -5101,7 +5058,6 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
pm.add(llvm::createLowerInvokePass()); pm.add(llvm::createLowerInvokePass());
pm.add(llvm::createCFGSimplificationPass()); // clean up after lower invoke. pm.add(llvm::createCFGSimplificationPass()); // clean up after lower invoke.
pm.add(new SmearCleanupPass(module, vectorWidth)); pm.add(new SmearCleanupPass(module, vectorWidth));
pm.add(new BitcastCleanupPass());
pm.add(new AndCmpCleanupPass()); pm.add(new AndCmpCleanupPass());
pm.add(new MaskOpsCleanupPass(module)); pm.add(new MaskOpsCleanupPass(module));
pm.add(llvm::createDeadCodeEliminationPass()); // clean up after smear pass pm.add(llvm::createDeadCodeEliminationPass()); // clean up after smear pass

View File

@@ -469,25 +469,15 @@
./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.4 icpc15.0 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/exclusive-scan-add-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/exclusive-scan-add-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
./tests/exclusive-scan-add-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 * ./tests/exclusive-scan-add-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
@@ -630,26 +620,16 @@
./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc15.0 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 * ./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
@@ -794,26 +774,16 @@
./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/aossoa-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/aossoa-7.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/aossoa-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc15.0 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 * ./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
@@ -1018,13 +988,3 @@
./tests/funcptr-varying-7.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 * ./tests/funcptr-varying-7.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/funcptr-varying-8.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 * ./tests/funcptr-varying-8.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/soa-18.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 * ./tests/soa-18.ispc runfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.7 icpc15.0 -O0 *