From aca88e185a5233e6306bd6196864668b09342490 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= <bsteinbr@gmail.com>
Date: Fri, 26 Jan 2018 09:53:48 +0100
Subject: [PATCH] Upgrade LLVM to incorporate a fix for #47364

Fixes #47364
---
 src/llvm                          |  2 +-
 src/rustllvm/llvm-rebuild-trigger |  2 +-
 src/test/run-pass/issue-47364.rs  | 66 +++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 src/test/run-pass/issue-47364.rs

diff --git a/src/llvm b/src/llvm
index 2717444753318..bc344d5bc23c6 160000
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit 2717444753318e461e0c3b30dacd03ffbac96903
+Subproject commit bc344d5bc23c61ff9baf82d268a0edf199933cc3
diff --git a/src/rustllvm/llvm-rebuild-trigger b/src/rustllvm/llvm-rebuild-trigger
index 7f54d9276bfc7..2635ca73303e7 100644
--- a/src/rustllvm/llvm-rebuild-trigger
+++ b/src/rustllvm/llvm-rebuild-trigger
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2017-11-08
+2018-01-25
diff --git a/src/test/run-pass/issue-47364.rs b/src/test/run-pass/issue-47364.rs
new file mode 100644
index 0000000000000..2847ac2a0ba43
--- /dev/null
+++ b/src/test/run-pass/issue-47364.rs
@@ -0,0 +1,66 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C codegen-units=8 -O
+
+fn main() {
+    nom_sql::selection(b"x ");
+}
+
+pub enum Err<P>{
+    Position(P),
+    NodePosition(u32),
+}
+
+pub enum IResult<I,O> {
+    Done(I,O),
+    Error(Err<I>),
+    Incomplete(u32, u64)
+}
+
+pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
+    ::IResult::Done(0, 0)
+}
+
+mod nom_sql {
+    fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
+        let X = match ::multispace(i) {
+            ::IResult::Done(..) => ::IResult::Done(i, None::<String>),
+            _ => ::IResult::Error(::Err::NodePosition(0)),
+        };
+        match X {
+            ::IResult::Done(_, _) => ::IResult::Done(i, None),
+            _ => X
+        }
+    }
+
+    pub fn selection(i: &[u8]) {
+        let Y = match {
+            match {
+                where_clause(i)
+            } {
+                ::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
+                ::IResult::Error(_) => ::IResult::Done(i, None),
+                _ => ::IResult::Incomplete(0, 0),
+            }
+        } {
+            ::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
+            _ => return ()
+        };
+        match Y {
+            ::IResult::Done(x, _) => {
+                let bytes = b";   ";
+                let len = x.len();
+                bytes[len];
+            }
+            _ => ()
+        }
+    }
+}