This is an archive of the discontinued LLVM Phabricator instance.

Fix LLVM_OPTIMIZED_TABLEGEN CMake option
AbandonedPublic

Authored by mehdi_amini on Apr 10 2015, 12:54 PM.

Details

Reviewers
beanz
Summary

The -DCMAKE_BUILD_TYPE was not passed to the configure in the
definition of the ${LLVM_${target_name}_BUILD}/CMakeCache.txt target.

It was somehow working because when running CMake from scratch and
the NATIVE directory didn't exist it forced the creation and
configuration at that time using a separate command which correctly
set the option.
We can lazilly create the directory if it does not exist during the
first run, unless I missed a good reason to force create it during the
initial cmake run.

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to Fix LLVM_OPTIMIZED_TABLEGEN CMake option.
mehdi_amini updated this object.
mehdi_amini edited the test plan for this revision. (Show Details)
mehdi_amini added a reviewer: beanz.
mehdi_amini added a subscriber: Unknown Object (MLST).
beanz edited edge metadata.Apr 10 2015, 1:53 PM

What is the problem you're trying to fix? Everything this changes was done this way by design.

The big reason for not doing it this way was that it allowed users to create their own cross build directories and pass them in if they wanted to. This is something we've done in the past although I'm not sure if we still are. That's why there are no options specified on the command that runs during the build. That way we don't override options if someone already set some.

I am trying to get the option LLVM_OPTIMIZED_TABLEGEN robust, it sometimes disappear from my build dir.

We discussed about that on llvm-commits last month and I wrote you:
"My impression is that if the NATIVE subdirectory is created while running cmake on the parent directory, it will be correctly create with CMAKE_BUILD_TYPE=RELEASE. If does not exist when running ninja, it is created and configured without the parameters." At that time you were considering this as an issue and not a feature since you told me: "Sounds like you have a handle on the issue. Patches welcome :-)."

beanz added a comment.Apr 10 2015, 2:32 PM

Ok, it is a well established fact that my memory sucks...

I still don't disagree with this being a bug. I just disagree with how you're fixing it.

Your fix passes the flag not just if the directory doesn't exist, but also if it is out-of-date. Meaning, while this does fix your problem, it also changes functionality. I'd prefer a solution that didn't change the behavior.

Setting build type when creating the directory is ok, but we shouldn't override it if it was already set.

OK, Makes sense.

mehdi_amini abandoned this revision.Apr 10 2015, 5:15 PM

I may come back later with a fix that matches the spec :)