This is an archive of the discontinued LLVM Phabricator instance.

Remove nasty environment variables in MachineVerifier in favor of a build option
AbandonedPublic

Authored by resistor on Feb 2 2015, 4:05 PM.

Details

Summary

This patch removes two uses of getenv() to read environment variables related to the MachineVerifier. Instead, it creates a new CMake build variable LLVM_ENABLE_MACHINE_VERIFIER that can be used to achieve the same purpose. There's a little bit of CMake cleverness involved here to minimize the amount of rebuilding required when toggling the flag on or off, which is important in my envisioned use case of staged builders.

Diff Detail

Repository
rL LLVM

Event Timeline

resistor updated this revision to Diff 19201.Feb 2 2015, 4:05 PM
resistor retitled this revision from to Remove nasty environment variables in MachineVerifier in favor of a build option.
resistor updated this object.
resistor edited the test plan for this revision. (Show Details)
resistor added a reviewer: chandlerc.
resistor set the repository for this revision to rL LLVM.
resistor added a subscriber: Unknown Object (MLST).

FWIW the autoconf changes for this should also be trivial :)

Patch-patches welcome. :-p

—Owen

chandlerc accepted this revision.Feb 2 2015, 10:04 PM
chandlerc edited edge metadata.

So, I have no problem with this patch or this design. It seems like a nice cleanup.

However, I'll float another idea:

What about adding a getenv call to lit (and maybe a flag) to flip this flag? No rebuild required, etc. Thoughts?

lib/CodeGen/MachineVerifier.cpp
278

Why not just set this in the constructor (perhaps from a defaulted argument)? It can also be a reference then.

This revision is now accepted and ready to land.Feb 2 2015, 10:04 PM
mehdi_amini edited edge metadata.Feb 2 2015, 10:07 PM

This is something I'd like!
Actually I was thinking that lit could replace "llc" with "llc --verify-machineinstrs" on the RUN line. Do you prefer to keep an environment variable inside LLVM?

resistor abandoned this revision.Feb 3 2015, 10:29 AM

Abandoning this, as Chandler pointed out a better approach on IRC. The patch coming soon.