about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJed Davis <jld@panix.com>2013-04-30 12:05:06 -0700
committerJed Davis <jld@panix.com>2013-04-30 12:05:06 -0700
commit41d06dbd28a9c26ecf114c020c6d855252fe323c (patch)
treef4ef3f59950be8e129a64916c8df5e21a6d6fb86
parentc081ffbd1e845687202a975ea2e698b623e5722f (diff)
downloadrust-41d06dbd28a9c26ecf114c020c6d855252fe323c.tar.gz
rust-41d06dbd28a9c26ecf114c020c6d855252fe323c.zip
Reverse accidental src/llvm reversion in 876483dcf, and add test.
The test is reduced from a doc test, but making it separate ensures that
(1) unrelated changes to the docs won't leave this case uncovered, and
(2) the nature of any future failures will be more obvious to whoever
sees the tree on fire as a result.
m---------src/llvm0
-rw-r--r--src/test/run-pass/enum-nullable-simplifycfg-misopt.rs24
2 files changed, 24 insertions, 0 deletions
diff --git a/src/llvm b/src/llvm
-Subproject 56dd407f4f97a01b8df6554c569170d2fc276fc
+Subproject 2e9f0d21fe321849a4759a01fc28eae82ef196d
diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs
new file mode 100644
index 00000000000..b5cf15f3b38
--- /dev/null
+++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs
@@ -0,0 +1,24 @@
+// Copyright 2013 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.
+
+/*!
+ * This is a regression test for a bug in LLVM, fixed in upstream r179587,
+ * where the switch instructions generated for destructuring enums
+ * represented with nullable pointers could be misoptimized in some cases.
+ */
+
+enum List<X> { Nil, Cons(X, @List<X>) }
+pub fn main() {
+    match Cons(10, @Nil) {
+	Cons(10, _) => {}
+	Nil => {}
+	_ => fail!()
+    }
+}