Start reserving x18 by default on Android targets.

This is a cherry pick of upstream LLVM r340889.

Bug: b/74603866
Change-Id: I9d0fd16d20d690b5c930e0a915dad8247890fc38
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/46048
Tested-by: Peter Collingbourne <pcc@google.com>
Presubmit-Ready: Peter Collingbourne <pcc@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/third_party/llvm-7.0/llvm/lib/Support/TargetParser.cpp b/third_party/llvm-7.0/llvm/lib/Support/TargetParser.cpp
index 2c167a4..2e757ba 100644
--- a/third_party/llvm-7.0/llvm/lib/Support/TargetParser.cpp
+++ b/third_party/llvm-7.0/llvm/lib/Support/TargetParser.cpp
@@ -935,5 +935,6 @@
 }
 
 bool llvm::AArch64::isX18ReservedByDefault(const Triple &TT) {
-  return TT.isOSDarwin() || TT.isOSFuchsia() || TT.isOSWindows();
+  return TT.isAndroid() || TT.isOSDarwin() || TT.isOSFuchsia() ||
+         TT.isOSWindows();
 }
diff --git a/third_party/llvm-7.0/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll b/third_party/llvm-7.0/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll
index 145066e..8997596 100644
--- a/third_party/llvm-7.0/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll
+++ b/third_party/llvm-7.0/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll
@@ -3,6 +3,7 @@
 ; RUN: llc -mtriple=aarch64-fuchsia -mattr=+reserve-x20 -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X20
 ; RUN: llc -mtriple=aarch64-fuchsia -mattr=+reserve-x18,+reserve-x20 -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18 --check-prefix=CHECK-RESERVE-X20
 ; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-linux-android -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18
 ; RUN: llc -mtriple=aarch64-fuchsia -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18
 ; RUN: llc -mtriple=aarch64-windows -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18