Skip to content

Commit 675a9a8

Browse files
authored
more precise memcpy tt (#140)
1 parent 25d1989 commit 675a9a8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

compiler/rustc_ast/src/expand/typetree.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ impl TypeTree {
1818
pub fn new() -> Self {
1919
Self(Vec::new())
2020
}
21+
pub fn all_ints() -> Self {
22+
Self(vec![Type { offset: -1, size: 1, kind: Kind::Integer, child: TypeTree::new() }])
23+
}
24+
pub fn int(size: usize) -> Self {
25+
let mut ints = Vec::with_capacity(size);
26+
for i in 0..size {
27+
ints.push(Type { offset: i as isize, size: 1, kind: Kind::Integer, child: TypeTree::new() });
28+
}
29+
Self(ints)
30+
}
2131
}
2232

2333
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
3030
count: Bx::Value,
3131
) {
3232
let tcx: TyCtxt<'_> = bx.cx().tcx();
33-
let fnc_tree: TypeTree = typetree_from(tcx, ty);
33+
let tt: TypeTree = typetree_from(tcx, ty);
3434
let fnc_tree: FncTree = FncTree {
35-
args: vec![fnc_tree.clone(), fnc_tree.clone()],
35+
args: vec![tt.clone(), tt.clone(), TypeTree::all_ints()],
3636
ret: TypeTree::new(),
3737
};
3838

@@ -58,9 +58,9 @@ fn memset_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
5858
count: Bx::Value,
5959
) {
6060
let tcx: TyCtxt<'_> = bx.cx().tcx();
61-
let fnc_tree: TypeTree = typetree_from(tcx, ty);
61+
let tt: TypeTree = typetree_from(tcx, ty);
6262
let fnc_tree: FncTree = FncTree {
63-
args: vec![fnc_tree.clone(), fnc_tree.clone()],
63+
args: vec![tt.clone(), tt.clone(), TypeTree::all_ints()],
6464
ret: TypeTree::new(),
6565
};
6666

0 commit comments

Comments
 (0)