Skip to content

Commit

Permalink
FileCheck aggregate.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent 378abbc commit 6564bac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 174 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 14 additions & 4 deletions tests/mir-opt/const_prop/aggregate.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -O

// EMIT_MIR aggregate.main.ConstProp.diff
// EMIT_MIR aggregate.main.PreCodegen.after.mir
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK-NOT: = Add(
// CHECK: [[x]] = const 1_u8;
// CHECK-NOT: = Add(
// CHECK: foo(const 1_u8)
let x = (0, 1, 2).1 + 0;
foo(x);
}

// Verify that we still propagate if part of the aggregate is not known.
// EMIT_MIR aggregate.foo.ConstProp.diff
// EMIT_MIR aggregate.foo.PreCodegen.after.mir
fn foo(x: u8) {
// Verify that we still propagate if part of the aggregate is not known.
// CHECK-LABEL: fn foo(
// CHECK: debug first => [[first:_.*]];
// CHECK: debug second => [[second:_.*]];
// CHECK-NOT: = Add(
// CHECK: [[first]] = const 1_i32;
// CHECK-NOT: = Add(
// CHECK: [[second]] = const 3_i32;
let first = (0, x).0 + 1;
let second = (x, 1).1 + 2;
}

0 comments on commit 6564bac

Please sign in to comment.