about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-16 00:13:26 +0000
committerbors <bors@rust-lang.org>2021-01-16 00:13:26 +0000
commit6c869d34ae2d87d21db9892d4dc088639bcbe041 (patch)
tree934fcc1bd4782a3810b643633412ab8649ea58fa /src/test/codegen
parentfcbd305ee93f49f19313b9bbeaa25ba8837030d9 (diff)
parentf8b1baac113ed85175453e6dad709dbd65836540 (diff)
downloadrust-6c869d34ae2d87d21db9892d4dc088639bcbe041.tar.gz
rust-6c869d34ae2d87d21db9892d4dc088639bcbe041.zip
Auto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #77693 (Add test for #59352)
 - #80515 (Improve JS performance by storing length before comparing to it in loops)
 - #81030 (Update mdbook)
 - #81033 (Remove useless `clean::Variant` struct)
 - #81049 (inline: Round word-size cost estimates up)
 - #81054 (Drop a few unneeded borrows)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/issue-59352.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/codegen/issue-59352.rs b/src/test/codegen/issue-59352.rs
new file mode 100644
index 00000000000..28bb8591232
--- /dev/null
+++ b/src/test/codegen/issue-59352.rs
@@ -0,0 +1,18 @@
+// This test is a mirror of mir-opt/issues/issue-59352.rs. The LLVM inliner doesn't inline
+// `char::method::is_digit()` and `char::method::to_digit()`, probably because of their size.
+//
+// Currently, the MIR optimizer isn't capable of removing the unreachable panic in this test case.
+// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this
+// test case should be removed as it will become redundant.
+
+// mir-opt-level=2 enables inlining and enables LLVM to optimize away the unreachable panic call.
+// compile-flags: -O -Z mir-opt-level=2
+
+#![crate_type = "rlib"]
+
+// CHECK-LABEL: @num_to_digit
+#[no_mangle]
+pub fn num_to_digit(num: char) -> u32 {
+    // CHECK-NOT: panic
+    if num.is_digit(8) { num.to_digit(8).unwrap() } else { 0 }
+}