We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c6b302 commit e66f88cCopy full SHA for e66f88c
tests/codegen/issues/issue-112169.rs
@@ -0,0 +1,28 @@
1
+//@ compile-flags: -O
2
+#![crate_type = "lib"]
3
+
4
+// Test that simple iterator-based loops of length > 101 are fully optimized away.
5
+// See <https://github.com/rust-lang/rust/issues/112169>
6
7
+// CHECK-LABEL: define{{.*}}i32 @issue_112169(){{.*}}{
8
+#[no_mangle]
9
+pub fn issue_112169() -> i32 {
10
+ // CHECK-NOT: icmp
11
+ // CHECK-NOT: add
12
+ // CHECK-NOT: br
13
+ // CHECK: ret i32 102
14
15
16
17
+ let mut s = 0;
18
19
+ for i in 0..102 {
20
+ if i == 0 {
21
+ s = i;
22
+ }
23
24
+ s += 1;
25
26
27
+ s
28
+}
0 commit comments