Most murderers are not mentally ill and most mentally ill are not murderers.
As a mental health professional with 30+ years experience working with people with mental illness (and as a gun owner), and having read extensively on this issue, I know that mental illness is clearly NOT the most important place to focus when talking about strategies to reduce gun violence. It's an old NRA trick to deflect reasonable talk about violence and gun control by focusing on mental health and insinuating that homicides are comitted primarily by the mentally ill (of course their other tactic is to maintain the laughable assertion that such crimes are committed only "by criminals", which is of course correct since after the commission of a murder, the killer becomes a criminal, conveniently avoiding that before the murder they were just a law abiding gun owner). The mentally ill are so badly stigmatized they make an excellent decoy.
In looking at the relationship between mental illness and homicide one might ask why 89.5% of all murders are committed by men, while women make up a substantially larger proportion of those with mental ilness ((21.7% females to 14.5% males (NIMH 2016)).
While most of us might agree that anyone who would be so anti-social so as to murder another human must have something wrong with their mental health, only very few murderers (including mass shooters) might be identified or diagnosed with mental illness before they acted, thus having little impact on the overall rate of homicide. Further, there is no technology that yet exists that would allow us to accurately identify a potential murderer ahead of time and take their guns or otherwise prevent them from committing a crime (and one might ask what the consequences of such technology might be (e.g., "The Minority Report" by Philip K. Dick)). Current law (which varies by state) already requires "mandated reporters" (e.g., doctor, psychologist, social worker, EMT, etc.) to report to the police anyone who appears to be a danger to themself or another; and they then are involuntarily hospitalized and evaluated.
Finally, despite all the blame mis-placed on the mentally ill for this carnage, our country has consistently horribly under-funded mental health care; during my lengthy career I have seen this only worsen over the years. The current "safety net" is almost non-existent.
I think making it more difficult for the mentally ill to buy guns would have very little impact on overall gun homicides (though it could potentially reduce suicides). Funding better mental health care would go further to reduce this, but given my experience I do not expect that to happen. The focus should be on laws that would have the most impact on reducing gun violence, and those laws should limit which types of firearms can be purchased by anyone. Eliminating the sale of assault rifles would be a start. Eliminating the sale of hand guns would have the most positive impact.
Here is a good article: https://www.theatlantic.com/health/archive/2016/06/untangling-gun-violence-from-mental-illness/485906/