Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: tools/clang/scripts/update.sh

Issue 790263003: Roll Clang 218707:223109 (+r223211, +r223219, -r220714), take 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't bump the plugin number Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script will check out llvm and clang into third_party/llvm and build it. 6 # This script will check out llvm and clang into third_party/llvm and build it.
7 7
8 # Do NOT CHANGE this if you don't know what you're doing -- see 8 # Do NOT CHANGE this if you don't know what you're doing -- see
9 # https://code.google.com/p/chromium/wiki/UpdatingClang 9 # https://code.google.com/p/chromium/wiki/UpdatingClang
10 # Reverting problematic clang rolls is safe, though. 10 # Reverting problematic clang rolls is safe, though.
11 CLANG_REVISION=218707 11 CLANG_REVISION=223109
12 12
13 THIS_DIR="$(dirname "${0}")" 13 THIS_DIR="$(dirname "${0}")"
14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" 16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" 17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" 18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
19 CLANG_DIR="${LLVM_DIR}/tools/clang" 19 CLANG_DIR="${LLVM_DIR}/tools/clang"
20 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" 20 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt"
21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" 21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 echo Reverting previously patched files 232 echo Reverting previously patched files
233 for i in \ 233 for i in \
234 "${CLANG_DIR}/test/Index/crash-recovery-modules.m" \ 234 "${CLANG_DIR}/test/Index/crash-recovery-modules.m" \
235 "${CLANG_DIR}/unittests/libclang/LibclangTest.cpp" \ 235 "${CLANG_DIR}/unittests/libclang/LibclangTest.cpp" \
236 "${COMPILER_RT_DIR}/lib/asan/asan_rtl.cc" \ 236 "${COMPILER_RT_DIR}/lib/asan/asan_rtl.cc" \
237 "${COMPILER_RT_DIR}/test/asan/TestCases/Linux/new_array_cookie_test.cc" \ 237 "${COMPILER_RT_DIR}/test/asan/TestCases/Linux/new_array_cookie_test.cc" \
238 "${LLVM_DIR}/test/DebugInfo/gmlt.ll" \ 238 "${LLVM_DIR}/test/DebugInfo/gmlt.ll" \
239 "${LLVM_DIR}/lib/CodeGen/SpillPlacement.cpp" \ 239 "${LLVM_DIR}/lib/CodeGen/SpillPlacement.cpp" \
240 "${LLVM_DIR}/lib/CodeGen/SpillPlacement.h" \ 240 "${LLVM_DIR}/lib/CodeGen/SpillPlacement.h" \
241 "${LLVM_DIR}/lib/Transforms/Instrumentation/MemorySanitizer.cpp" \
242 "${CLANG_DIR}/test/Driver/env.c" \
243 "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \
244 "${CLANG_DIR}/test/Frontend/exceptions.c" \
245 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \
246 "${LLVM_DIR}/test/Bindings/Go/go.test" \
241 ; do 247 ; do
242 if [[ -e "${i}" ]]; then 248 if [[ -e "${i}" ]]; then
249 rm -f "${i}" # For unversioned files.
243 svn revert "${i}" 250 svn revert "${i}"
244 fi; 251 fi;
245 done 252 done
246 253
247 echo Remove the Clang tools shim dir 254 echo Remove the Clang tools shim dir
248 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools 255 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools
249 rm -rfv ${CHROME_TOOLS_SHIM_DIR} 256 rm -rfv ${CHROME_TOOLS_SHIM_DIR}
250 257
251 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" 258 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
252 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \ 259 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 317
311 -TEST_F(LibclangReparseTest, ReparseWithModule) { 318 -TEST_F(LibclangReparseTest, ReparseWithModule) {
312 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { 319 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
313 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; 320 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
314 const char *HeaderBottom = "\n};\n#endif\n"; 321 const char *HeaderBottom = "\n};\n#endif\n";
315 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" 322 const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
316 EOF 323 EOF
317 patch -p0 324 patch -p0
318 popd 325 popd
319 326
320 # Apply r218742: test: XFAIL the non-darwin gmlt test on darwin 327 # Apply r223211: "Revert r222997."
321 # Back-ported becase the test was renamed.
322 pushd "${LLVM_DIR}" 328 pushd "${LLVM_DIR}"
323 cat << 'EOF' | 329 cat << 'EOF' |
324 --- a/test/DebugInfo/gmlt.ll 330 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
325 +++ b/test/DebugInfo/gmlt.ll 331 +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
326 @@ -1,2 +1,5 @@ 332 @@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySan itizerVisitor> {
327 ; REQUIRES: object-emission 333 Value *OriginPtr =
328 ; RUN: %llc_dwarf -O0 -filetype=obj < %S/Inputs/gmlt.ll | llvm-dwarfdump - | Fi leCheck %S/Inputs/gmlt.ll 334 getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
329 + 335 setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
330 +; There's a darwin specific test in X86/gmlt, so it's okay to XFAIL this here. 336 - } else {
331 +; XFAIL: darwin 337 - setOrigin(A, getCleanOrigin());
338 }
339 }
340 ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
341 @@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
342 /// \brief Get the origin for a value.
343 Value *getOrigin(Value *V) {
344 if (!MS.TrackOrigins) return nullptr;
345 - if (!PropagateShadow) return getCleanOrigin();
346 - if (isa<Constant>(V)) return getCleanOrigin();
347 - assert((isa<Instruction>(V) || isa<Argument>(V)) &&
348 - "Unexpected value type in getOrigin()");
349 - Value *Origin = OriginMap[V];
350 - assert(Origin && "Missing origin");
351 - return Origin;
352 + if (isa<Instruction>(V) || isa<Argument>(V)) {
353 + Value *Origin = OriginMap[V];
354 + if (!Origin) {
355 + DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
356 + Origin = getCleanOrigin();
357 + }
358 + return Origin;
359 + }
360 + return getCleanOrigin();
361 }
362
363 /// \brief Get the origin for i-th argument of the instruction I.
364 @@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
365 IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
366
367 setShadow(&I, getCleanShadow(&I));
368 - setOrigin(&I, getCleanOrigin());
369 }
370
371 void visitAtomicRMWInst(AtomicRMWInst &I) {
332 EOF 372 EOF
333 patch -p1 373 patch -p1
334 popd 374 popd
335 375
336 # Apply r218921; fixes spill placement compile-time regression. 376 # Apply r223219: "Preserve LD_LIBRARY_PATH when using the 'env' command"
377 pushd "${CLANG_DIR}"
378 cat << 'EOF' |
379 --- a/test/Driver/env.c
380 +++ b/test/Driver/env.c
381 @@ -5,12 +5,14 @@
382 // REQUIRES: shell
383 //
384 // The PATH variable is heavily used when trying to find a linker.
385 -// RUN: env -i LC_ALL=C %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
386 +// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
387 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
388 // RUN: --target=i386-unknown-linux \
389 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
390 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
391 //
392 -// RUN: env -i LC_ALL=C PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2 >&1 \
393 +// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
394 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
395 // RUN: --target=i386-unknown-linux \
396 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
397 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
398 EOF
399 patch -p1
400 popd
401
402 # Revert r220714: "Frontend: Define __EXCEPTIONS if -fexceptions is passed"
403 pushd "${CLANG_DIR}"
404 cat << 'EOF' |
405 --- a/lib/Frontend/InitPreprocessor.cpp
406 +++ b/lib/Frontend/InitPreprocessor.cpp
407 @@ -566,7 +566,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
408 Builder.defineMacro("__BLOCKS__");
409 }
410
411 - if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
412 + if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
413 Builder.defineMacro("__EXCEPTIONS");
414 if (!LangOpts.MSVCCompat && LangOpts.RTTI)
415 Builder.defineMacro("__GXX_RTTI");
416 diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c
417 index 981b5b9..4bbaaa3 100644
418 --- a/test/Frontend/exceptions.c
419 +++ b/test/Frontend/exceptions.c
420 @@ -1,9 +1,6 @@
421 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE - verify %s
422 +// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
423 // expected-no-diagnostics
424
425 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s
426 -// expected-no-diagnostics
427 -
428 -#if defined(MS_MODE) && defined(__EXCEPTIONS)
429 +#if defined(__EXCEPTIONS)
430 #error __EXCEPTIONS should not be defined.
431 #endif
432 diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/prede fined-exceptions.m
433 index 0791075..c13f429 100644
434 --- a/test/Preprocessor/predefined-exceptions.m
435 +++ b/test/Preprocessor/predefined-exceptions.m
436 @@ -1,6 +1,6 @@
437 // RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | Fi leCheck -check-prefix=CHECK-OBJC-NOCXX %s
438 // CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
439 -// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
440 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
441
442 // RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-except ions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
443 // CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
444 EOF
445 patch -p1
446 popd
447
448 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR2155 2)
337 pushd "${LLVM_DIR}" 449 pushd "${LLVM_DIR}"
338 cat << 'EOF' | 450 cat << 'EOF' |
339 --- a/lib/CodeGen/SpillPlacement.cpp 451 Index: test/Bindings/Go/go.test
340 +++ b/lib/CodeGen/SpillPlacement.cpp 452 ===================================================================
341 @@ -61,27 +61,6 @@ void SpillPlacement::getAnalysisUsage(AnalysisUsage &AU) cons t { 453 --- test/Bindings/Go/go.test (revision 223109)
342 MachineFunctionPass::getAnalysisUsage(AU); 454 +++ test/Bindings/Go/go.test (working copy)
343 } 455 @@ -1,3 +1,3 @@
456 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
457 +; RUN: true
344 458
345 -namespace { 459 ; REQUIRES: shell
346 -static ManagedStatic<BlockFrequency> Threshold;
347 -}
348 -
349 -/// Decision threshold. A node gets the output value 0 if the weighted sum of
350 -/// its inputs falls in the open interval (-Threshold;Threshold).
351 -static BlockFrequency getThreshold() { return *Threshold; }
352 -
353 -/// \brief Set the threshold for a given entry frequency.
354 -///
355 -/// Set the threshold relative to \c Entry. Since the threshold is used as a
356 -/// bound on the open interval (-Threshold;Threshold), 1 is the minimum
357 -/// threshold.
358 -static void setThreshold(const BlockFrequency &Entry) {
359 - // Apparently 2 is a good threshold when Entry==2^14, but we need to scale
360 - // it. Divide by 2^13, rounding as appropriate.
361 - uint64_t Freq = Entry.getFrequency();
362 - uint64_t Scaled = (Freq >> 13) + bool(Freq & (1 << 12));
363 - *Threshold = std::max(UINT64_C(1), Scaled);
364 -}
365 -
366 /// Node - Each edge bundle corresponds to a Hopfield node.
367 ///
368 /// The node contains precomputed frequency data that only depends on the CFG,
369 @@ -127,9 +106,9 @@ struct SpillPlacement::Node {
370
371 /// clear - Reset per-query data, but preserve frequencies that only depend o n
372 // the CFG.
373 - void clear() {
374 + void clear(const BlockFrequency &Threshold) {
375 BiasN = BiasP = Value = 0;
376 - SumLinkWeights = getThreshold();
377 + SumLinkWeights = Threshold;
378 Links.clear();
379 }
380
381 @@ -167,7 +146,7 @@ struct SpillPlacement::Node {
382
383 /// update - Recompute Value from Bias and Links. Return true when node
384 /// preference changes.
385 - bool update(const Node nodes[]) {
386 + bool update(const Node nodes[], const BlockFrequency &Threshold) {
387 // Compute the weighted sum of inputs.
388 BlockFrequency SumN = BiasN;
389 BlockFrequency SumP = BiasP;
390 @@ -187,9 +166,9 @@ struct SpillPlacement::Node {
391 // 2. It helps tame rounding errors when the links nominally sum to 0.
392 //
393 bool Before = preferReg();
394 - if (SumN >= SumP + getThreshold())
395 + if (SumN >= SumP + Threshold)
396 Value = -1;
397 - else if (SumP >= SumN + getThreshold())
398 + else if (SumP >= SumN + Threshold)
399 Value = 1;
400 else
401 Value = 0;
402 @@ -228,7 +207,7 @@ void SpillPlacement::activate(unsigned n) {
403 if (ActiveNodes->test(n))
404 return;
405 ActiveNodes->set(n);
406 - nodes[n].clear();
407 + nodes[n].clear(Threshold);
408
409 // Very large bundles usually come from big switches, indirect branches,
410 // landing pads, or loops with many 'continue' statements. It is difficult to
411 @@ -245,6 +224,18 @@ void SpillPlacement::activate(unsigned n) {
412 }
413 }
414
415 +/// \brief Set the threshold for a given entry frequency.
416 +///
417 +/// Set the threshold relative to \c Entry. Since the threshold is used as a
418 +/// bound on the open interval (-Threshold;Threshold), 1 is the minimum
419 +/// threshold.
420 +void SpillPlacement::setThreshold(const BlockFrequency &Entry) {
421 + // Apparently 2 is a good threshold when Entry==2^14, but we need to scale
422 + // it. Divide by 2^13, rounding as appropriate.
423 + uint64_t Freq = Entry.getFrequency();
424 + uint64_t Scaled = (Freq >> 13) + bool(Freq & (1 << 12));
425 + Threshold = std::max(UINT64_C(1), Scaled);
426 +}
427
428 /// addConstraints - Compute node biases and weights from a set of constraints.
429 /// Set a bit in NodeMask for each active node.
430 @@ -311,7 +302,7 @@ bool SpillPlacement::scanActiveBundles() {
431 Linked.clear();
432 RecentPositive.clear();
433 for (int n = ActiveNodes->find_first(); n>=0; n = ActiveNodes->find_next(n)) {
434 - nodes[n].update(nodes);
435 + nodes[n].update(nodes, Threshold);
436 // A node that must spill, or a node without any links is not going to
437 // change its value ever again, so exclude it from iterations.
438 if (nodes[n].mustSpill())
439 @@ -331,7 +322,7 @@ void SpillPlacement::iterate() {
440 // First update the recently positive nodes. They have likely received new
441 // negative bias that will turn them off.
442 while (!RecentPositive.empty())
443 - nodes[RecentPositive.pop_back_val()].update(nodes);
444 + nodes[RecentPositive.pop_back_val()].update(nodes, Threshold);
445
446 if (Linked.empty())
447 return;
448 @@ -350,7 +341,7 @@ void SpillPlacement::iterate() {
449 iteration == 0 ? Linked.rbegin() : std::next(Linked.rbegin()),
450 E = Linked.rend(); I != E; ++I) {
451 unsigned n = *I;
452 - if (nodes[n].update(nodes)) {
453 + if (nodes[n].update(nodes, Threshold)) {
454 Changed = true;
455 if (nodes[n].preferReg())
456 RecentPositive.push_back(n);
457 @@ -364,7 +355,7 @@ void SpillPlacement::iterate() {
458 for (SmallVectorImpl<unsigned>::const_iterator I =
459 std::next(Linked.begin()), E = Linked.end(); I != E; ++I) {
460 unsigned n = *I;
461 - if (nodes[n].update(nodes)) {
462 + if (nodes[n].update(nodes, Threshold)) {
463 Changed = true;
464 if (nodes[n].preferReg())
465 RecentPositive.push_back(n);
466 diff --git a/lib/CodeGen/SpillPlacement.h b/lib/CodeGen/SpillPlacement.h
467 index 03cf5cd..622361e 100644
468 --- a/lib/CodeGen/SpillPlacement.h
469 +++ b/lib/CodeGen/SpillPlacement.h
470 @@ -62,6 +62,10 @@ class SpillPlacement : public MachineFunctionPass {
471 // Block frequencies are computed once. Indexed by block number.
472 SmallVector<BlockFrequency, 8> BlockFrequencies;
473
474 + /// Decision threshold. A node gets the output value 0 if the weighted sum of
475 + /// its inputs falls in the open interval (-Threshold;Threshold).
476 + BlockFrequency Threshold;
477 +
478 public:
479 static char ID; // Pass identification, replacement for typeid.
480
481 @@ -152,6 +156,7 @@ private:
482 void releaseMemory() override;
483
484 void activate(unsigned);
485 + void setThreshold(const BlockFrequency &Entry);
486 };
487
488 } // end namespace llvm
489 EOF 460 EOF
490 patch -p1 461 patch -p0
491 popd 462 popd
492 463
493 464
494 # Echo all commands. 465 # Echo all commands.
495 set -x 466 set -x
496 467
497 # Set default values for CC and CXX if they're not set in the environment. 468 # Set default values for CC and CXX if they're not set in the environment.
498 CC=${CC:-cc} 469 CC=${CC:-cc}
499 CXX=${CXX:-c++} 470 CXX=${CXX:-c++}
500 471
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 706
736 if [[ -n "$run_tests" ]]; then 707 if [[ -n "$run_tests" ]]; then
737 # Run Chrome tool tests. 708 # Run Chrome tool tests.
738 ninja -C "${LLVM_BUILD_DIR}" cr-check-all 709 ninja -C "${LLVM_BUILD_DIR}" cr-check-all
739 # Run the LLVM and Clang tests. 710 # Run the LLVM and Clang tests.
740 ninja -C "${LLVM_BUILD_DIR}" check-all 711 ninja -C "${LLVM_BUILD_DIR}" check-all
741 fi 712 fi
742 713
743 # After everything is done, log success for this revision. 714 # After everything is done, log success for this revision.
744 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 715 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
OLDNEW
« no previous file with comments | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698