fix bugs found by LLVM assertions

This commit is contained in:
Jaden Weiss
2019-09-15 12:43:33 -04:00
parent d975ed9373
commit fee496ae79
9 changed files with 164 additions and 22 deletions
+6
View File
@@ -22,6 +22,12 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int, inlinerThreshold uint) erro
c.replacePanicsWithTrap() // -panic=trap
}
// run a check of all of our code
c.check()
if err := c.Verify(); err != nil {
return errors.New("verification failure before optimizations")
}
// Run function passes for each function.
funcPasses := llvm.NewFunctionPassManagerForModule(c.mod)
defer funcPasses.Dispose()