Update aosp/master compiler-rt for rebase to r222486.

Change-Id: I38047809dbac0425193c82e810315998adbb380d
diff --git a/test/profile/instrprof-basic.c b/test/profile/instrprof-basic.c
index 3db0831..fd3516c 100644
--- a/test/profile/instrprof-basic.c
+++ b/test/profile/instrprof-basic.c
@@ -3,10 +3,29 @@
 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
 // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
 
+int begin(int i) {
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
+  if (i)
+    return 0;
+  return 1;
+}
+
+int end(int i) {
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+  if (i)
+    return 0;
+  return 1;
+}
+
 int main(int argc, const char *argv[]) {
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  begin(0);
+  end(1);
+
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
   if (argc)
     return 0;
   return 1;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 2, i32 1}
+
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD2]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
diff --git a/test/profile/instrprof-dlopen.test b/test/profile/instrprof-dlopen.test
index f0c067f..ba386e3 100644
--- a/test/profile/instrprof-dlopen.test
+++ b/test/profile/instrprof-dlopen.test
@@ -1,8 +1,8 @@
 RUN: mkdir -p %t.d
 RUN: %clang_profgen -o %t.d/func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c
 RUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c
-RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/Inputs/instrprof-dlopen-main.c -ldl
-RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/Inputs/instrprof-dlopen-main.c -ldl
+RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/Inputs/instrprof-dlopen-main.c
+RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/Inputs/instrprof-dlopen-main.c
 
 RUN: %clang -c -o %t.d/main.o %S/Inputs/instrprof-dlopen-main.c
 RUN: %clang_profgen -o %t-static %S/Inputs/instrprof-dlopen-func.c %S/Inputs/instrprof-dlopen-func2.c %t.d/main.o
diff --git a/test/profile/instrprof-set-filename.c b/test/profile/instrprof-set-filename.c
index 51de14f..0458218 100644
--- a/test/profile/instrprof-set-filename.c
+++ b/test/profile/instrprof-set-filename.c
@@ -5,10 +5,10 @@
 
 void __llvm_profile_set_filename(const char *);
 int main(int argc, const char *argv[]) {
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
   __llvm_profile_set_filename(argv[1]);
   return 0;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
diff --git a/test/profile/instrprof-without-libc.c b/test/profile/instrprof-without-libc.c
index ca83d46..60ca949 100644
--- a/test/profile/instrprof-without-libc.c
+++ b/test/profile/instrprof-without-libc.c
@@ -17,8 +17,8 @@
 int __llvm_profile_write_buffer(char *);
 int write_buffer(uint64_t, const char *);
 int main(int argc, const char *argv[]) {
-  // CHECK-LABEL: define i32 @main(
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK-LABEL: define {{.*}} @main(
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
 
@@ -46,7 +46,7 @@
   return fclose(File);
 #endif
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
 
 // CHECK-SYMBOLS-NOT: ___cxx_global_var_init
 // CHECK-SYMBOLS-NOT: ___llvm_profile_register_write_file_atexit
diff --git a/test/profile/instrprof-write-file-atexit-explicitly.c b/test/profile/instrprof-write-file-atexit-explicitly.c
index 931a48b..ba229b9 100644
--- a/test/profile/instrprof-write-file-atexit-explicitly.c
+++ b/test/profile/instrprof-write-file-atexit-explicitly.c
@@ -8,10 +8,10 @@
 void __llvm_profile_set_filename(const char *);
 int main(int argc, const char *argv[]) {
   __llvm_profile_register_write_file_atexit();
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
   __llvm_profile_set_filename(argv[1]);
   return 0;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
diff --git a/test/profile/instrprof-write-file-only.c b/test/profile/instrprof-write-file-only.c
index 65a2226..0dd61de 100644
--- a/test/profile/instrprof-write-file-only.c
+++ b/test/profile/instrprof-write-file-only.c
@@ -9,8 +9,8 @@
 void __llvm_profile_set_filename(const char *);
 int foo(int);
 int main(int argc, const char *argv[]) {
-  // CHECK-LABEL: define i32 @main
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK-LABEL: define {{.*}} @main(
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc > 1)
     return 1;
 
@@ -28,8 +28,8 @@
   // There should be no profiling information for @foo, since it was called
   // after the profile was written (and the atexit was suppressed by defining
   // profile_runtime).
-  // CHECK-LABEL: define i32 @foo
+  // CHECK-LABEL: define {{.*}} @foo(
   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
   return X <= 0 ? -X : X;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
diff --git a/test/profile/instrprof-write-file.c b/test/profile/instrprof-write-file.c
index f5c2958..12967cb 100644
--- a/test/profile/instrprof-write-file.c
+++ b/test/profile/instrprof-write-file.c
@@ -9,8 +9,8 @@
 void __llvm_profile_set_filename(const char *);
 int foo(int);
 int main(int argc, const char *argv[]) {
-  // CHECK-LABEL: define i32 @main
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK-LABEL: define {{.*}} @main(
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
 
@@ -25,10 +25,10 @@
   return Ret;
 }
 int foo(int X) {
-  // CHECK-LABEL: define i32 @foo
+  // CHECK-LABEL: define {{.*}} @foo(
   // CHECK1: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
-  // CHECK2: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2
+  // CHECK2: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
   return X <= 0 ? -X : X;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
-// CHECK2: !2 = metadata !{metadata !"branch_weights", i32 2, i32 1}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK2: ![[PD2]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
diff --git a/test/profile/lit.cfg b/test/profile/lit.cfg
index 6e53b50..e4910ab 100644
--- a/test/profile/lit.cfg
+++ b/test/profile/lit.cfg
@@ -24,6 +24,11 @@
             lit_config.load_config(config, site_cfg)
             raise SystemExit
 
+if config.host_os in ['Linux']:
+  extra_linkflags = ["-ldl"]
+else:
+  extra_linkflags = []
+
 # Test suffixes.
 config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
 
@@ -31,7 +36,7 @@
 config.excludes = ['Inputs']
 
 # Clang flags.
-clang_cflags = [config.target_cflags]
+clang_cflags = [config.target_cflags] + extra_linkflags
 
 def build_invocation(compile_flags):
   return " " + " ".join([config.clang] + compile_flags) + " "
@@ -41,6 +46,8 @@
 config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
 config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") )
 
-# Profile tests are currently supported on Linux and Darwin only.
-if config.host_os not in ['Linux', 'Darwin']:
+if config.host_os not in ['Darwin', 'FreeBSD', 'Linux']:
+  config.unsupported = True
+
+if config.target_arch in ['armv7l']:
   config.unsupported = True