Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: less optimized AMD64 code #24537
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
For your first point, it has always been the case that when flagalloc needs to "spill" and "restore" flags, it leaves the old flag computation behind. It shouldn't be too hard to eliminate those comparisons. It wouldn't even require a full deadcode pass, because we know the args of the comparison are still used.
For your second point, this is working as expected, sort of. CMPQmem are generated, but they need to be undone during flagalloc. The problem is that we first schedule the CMPQmem, then a CMPQ for the bounds check. Because the bounds check clobbers flags, flagalloc must move the flag computation later, but it doesn't think it is safe to move the load later (it is safe, in this case, but it isn't in general).