As submitted upstream in a review, avoid using undefined behavior in

llvm's LinkAllPasses.h.  This caused some of the calls not to be
emitted, if the optimization level was -O2 or higher.

Conversely, if you used -O1 or lower, calls to e.g.  RunningOnValgrind()
would be emitted, leading to link failures, because we did not include
Valgrind.cpp into libllvmsupport.  Therefore, add it unconditionally.

Noticed by:	ian
This commit is contained in:
Dimitry Andric 2016-01-08 17:32:42 +00:00
parent 17bf72a25b
commit fdd1590a42
2 changed files with 4 additions and 4 deletions

View File

@ -185,9 +185,9 @@ namespace {
(void)new llvm::IntervalPartition();
(void)new llvm::ScalarEvolutionWrapperPass();
((llvm::Function*)nullptr)->viewCFGOnly();
((llvm::Function*)1)->viewCFGOnly();
llvm::RGPassManager RGM;
((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
((llvm::RegionPass*)1)->runOnRegion((llvm::Region*)nullptr, RGM);
llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
X.add(nullptr, 0, llvm::AAMDNodes()); // for -print-alias-sets
(void) llvm::AreStatisticsEnabled();

View File

@ -78,6 +78,7 @@ SRCS= APFloat.cpp \
Triple.cpp \
Twine.cpp \
Unicode.cpp \
Valgrind.cpp \
YAMLParser.cpp \
YAMLTraits.cpp \
circular_raw_ostream.cpp \
@ -101,8 +102,7 @@ SRCS+= ARMWinEH.cpp \
.endif
.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no"
SRCS+= Memory.cpp \
Valgrind.cpp
SRCS+= Memory.cpp
.endif
.include "../clang.lib.mk"