make check error for remove-global-vars.ll

Hi All,

The ‘make check -j’ command fails occasionally for the testcase remove-global-vars.ll, which is added in a recent commit.

We suspect this is because of a race condition occurring due to the simultaneous read of the file reduce.ll by FileCheck (when make check -j is used), which is generated by llvm-reduce. The file reduce.ll is both consumed by the testcases remove-global-vars.ll and remove-funcs.ll, which when executed in parallel, one of them might read the wrong reduce.ll generated by the other.

Could someone confirm this indeed is the case?


Caveat: I don’t know anything specific about llvm-reduce.

The source for llvm-reduce.cpp shows that the default output file is ‘reduce.ll’. However, the RUN lines on the tests specify “-o -” meaning the tests shouldn’t create a ‘reduce.ll’ file at all.

The tool does make an effort to create a unique temporary file for the intermediate reduction attempts; see Delta.cpp. It’s not impossible that there is some kind of filesystem race condition that permits two processes to try to generate the same file, although the Support library does try to avoid this. Delta.cpp uses only 3 random characters (the ‘%’ characters are replaced by random hex digits) so you could try adding another ‘%’ and see if that makes your problem go away.