On Tue, Mar 11, 2014 at 02:43:51PM +0800, Yang Rong wrote: > SROA and GVN may introduce some integer type not support by backend. > Remove this type assert in GenWrite, and found these types, set the unit to > invalid. If unit is invalid, use optLevel 0, which not include SROA and GVN, > and > try again. > > Signed-off-by: Yang Rong <[email protected]> > --- > backend/src/backend/program.cpp | 15 ++++++++++++--- > backend/src/ir/context.cpp | 3 ++- > backend/src/ir/unit.cpp | 2 +- > backend/src/ir/unit.hpp | 4 +++- > backend/src/llvm/llvm_gen_backend.cpp | 26 ++++++++++++++++++-------- > backend/src/llvm/llvm_to_gen.cpp | 5 +++-- > 6 files changed, 39 insertions(+), 16 deletions(-) > > diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp > index f656299..6b445fa 100644 > --- a/backend/src/backend/program.cpp > +++ b/backend/src/backend/program.cpp > @@ -103,12 +103,21 @@ namespace gbe { > BVAR(OCL_OUTPUT_GEN_IR, false); > > bool Program::buildFromLLVMFile(const char *fileName, std::string &error, > int optLevel) { > - ir::Unit unit; > - if (llvmToGen(unit, fileName, optLevel) == false) { > + ir::Unit *unit = new ir::Unit(); > + if (llvmToGen(*unit, fileName, optLevel) == false) { > error = std::string(fileName) + " not found"; > return false; > } > - this->buildFromUnit(unit, error); > + //If unit is not valid, maybe some thing don't support by backend, > introduce by some passes > + //use optLevel 0 to try again. > + if(!unit->getValid()) { > + delete unit; //clear unit > + unit = new ir::Unit(); > + llvmToGen(*unit, fileName, 0); //supose file is exit and llvmToGen > will not return false. minor typo the above comment should be "suppose file exists" right?
The other parts LGTM, I will fix the typo and push it latter. Thanks. _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
