[PATCH] D15996: Avoid undefined behavior in LinkAllPasses.h
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 09:51:48 PST 2016
Meinersbur added a comment.
Is it undefined behaviour if it never executes?
IMHO the complete function already relies on assumptions made on how intelligent today's compilers work as the initial comment states, so even whether any of the functions is linked in is undefined.
I have another suggestion how to to the same thing in a more conformant way:
(ForcePassLinging*)()[] = { &llvm::createAAEvalPass, &llvm::createAggressiveDCEPass, ... }
auto ForceRegionPassLinking = &llvm::Function::Create
Because the global variables are not static the compiler has to assume that these might be used somewhere else. LTO might remove it but that would be okay because it still has to execute the pass registration since the object file in question is linked-in.
Will still try with Polly on Windows
http://reviews.llvm.org/D15996
More information about the llvm-commits
mailing list