about summary refs log tree commit diff
path: root/src/test/codegen/vec-optimizes-away.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-07 22:30:39 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-09 11:44:21 -0700
commitc25ddf21f18c3eeeaea2a4dffd70d2f6183068b5 (patch)
tree9715e57405ae14bd7877dec129bce733daf72dc1 /src/test/codegen/vec-optimizes-away.rs
parentcc4ff8f4d169562ff4ae22b94197a191215e6d56 (diff)
parentc5e2051f070c01241f68720a92a0957bcb070597 (diff)
downloadrust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.tar.gz
rust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.zip
Merge remote-tracking branch 'origin/master' into gen
Diffstat (limited to 'src/test/codegen/vec-optimizes-away.rs')
-rw-r--r--src/test/codegen/vec-optimizes-away.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/codegen/vec-optimizes-away.rs b/src/test/codegen/vec-optimizes-away.rs
new file mode 100644
index 00000000000..261564ed51a
--- /dev/null
+++ b/src/test/codegen/vec-optimizes-away.rs
@@ -0,0 +1,21 @@
+// 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.
+//
+// no-system-llvm
+// compile-flags: -O
+#![crate_type="lib"]
+
+#[no_mangle]
+pub fn sum_me() -> i32 {
+    // CHECK-LABEL: @sum_me
+    // CHECK-NEXT: {{^.*:$}}
+    // CHECK-NEXT: ret i32 6
+    vec![1, 2, 3].iter().sum::<i32>()
+}