Skip to content

more precise memcpy tt #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions compiler/rustc_ast/src/expand/typetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ impl TypeTree {
pub fn new() -> Self {
Self(Vec::new())
}
pub fn all_ints() -> Self {
Self(vec![Type { offset: -1, size: 1, kind: Kind::Integer, child: TypeTree::new() }])
}
pub fn int(size: usize) -> Self {
let mut ints = Vec::with_capacity(size);
for i in 0..size {
ints.push(Type { offset: i as isize, size: 1, kind: Kind::Integer, child: TypeTree::new() });
}
Self(ints)
}
}

#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
count: Bx::Value,
) {
let tcx: TyCtxt<'_> = bx.cx().tcx();
let fnc_tree: TypeTree = typetree_from(tcx, ty);
let tt: TypeTree = typetree_from(tcx, ty);
let fnc_tree: FncTree = FncTree {
args: vec![fnc_tree.clone(), fnc_tree.clone()],
args: vec![tt.clone(), tt.clone(), TypeTree::all_ints()],
ret: TypeTree::new(),
};

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

Expand Down
Loading