about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Poveda <christianpoveda@protonmail.com>2018-09-22 16:48:33 -0500
committerChristian Poveda <christianpoveda@protonmail.com>2018-09-23 16:15:46 -0500
commit1e3c86e1c40e703f632087751d073b58bd96a6df (patch)
treeb36c202f3f0d7265de2c75465a2d674b464401b1
parent8efafa18e5ebc70d5219f8d9d016f2694dcb2196 (diff)
downloadrust-1e3c86e1c40e703f632087751d073b58bd96a6df.tar.gz
rust-1e3c86e1c40e703f632087751d073b58bd96a6df.zip
Add test to check if inlining works for any operand
-rw-r--r--src/test/mir-opt/inline-any-operand.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/mir-opt/inline-any-operand.rs b/src/test/mir-opt/inline-any-operand.rs
new file mode 100644
index 00000000000..da95842ea4d
--- /dev/null
+++ b/src/test/mir-opt/inline-any-operand.rs
@@ -0,0 +1,39 @@
+// 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: -Z span_free_formats
+
+// Tests that MIR inliner works for any operand
+
+fn main() {
+    println!("{}", bar());
+}
+
+#[inline(always)]
+fn foo(x: i32, y: i32) -> bool {
+    x == y
+}
+
+fn bar() -> bool {
+    let f = foo;
+    f(1, -1)
+}
+
+// END RUST SOURCE
+// START rustc.bar.Inline.after.mir
+// ...
+// bb0: {
+//     ...
+//     _0 = Eq(move _3, move _4);
+//     ...
+//     return;
+// }
+// ...
+// END rustc.bar.Inline.after.mir