Skip to content

Commit aa9ee68

Browse files
Rollup merge of #52171 - bharrisau:fsub-count, r=estebank
Correct some codegen stats counter inconsistencies I noticed some possible typos/inconsistencies in the codegen counters. For example, `fsub` was getting counted as an integer `sub`, whereas `fadd` was counted as an add. And `addincoming` was only being counted on the initial call. https://github.com/rust-lang/rust/blob/dbd10f81758381339f98994b8d31814cf5e98707/src/librustc_codegen_llvm/builder.rs#L831-L841 Only remaining inconsistencies I can see are things like `fadd_fast` are counted as `fadd`. But the vector versions like `vector_reduce_fmax_fast` are counted as `vector.reduce.fmax_fast` not as their 'base' versions (`vector_reduce_fmax` is counted as `vector.reduce.fmax`).
2 parents f7c2efd + aac0d91 commit aa9ee68

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc_codegen_llvm/builder.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
277277
}
278278

279279
pub fn nswsub(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
280-
self.count_insn("nwsub");
280+
self.count_insn("nswsub");
281281
unsafe {
282282
llvm::LLVMBuildNSWSub(self.llbuilder, lhs, rhs, noname())
283283
}
@@ -291,14 +291,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
291291
}
292292

293293
pub fn fsub(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
294-
self.count_insn("sub");
294+
self.count_insn("fsub");
295295
unsafe {
296296
llvm::LLVMBuildFSub(self.llbuilder, lhs, rhs, noname())
297297
}
298298
}
299299

300300
pub fn fsub_fast(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
301-
self.count_insn("sub");
301+
self.count_insn("fsub");
302302
unsafe {
303303
let instr = llvm::LLVMBuildFSub(self.llbuilder, lhs, rhs, noname());
304304
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
@@ -1315,6 +1315,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13151315
}
13161316

13171317
pub fn add_incoming_to_phi(&self, phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
1318+
self.count_insn("addincoming");
13181319
unsafe {
13191320
llvm::LLVMAddIncoming(phi, &val, &bb, 1 as c_uint);
13201321
}

0 commit comments

Comments
 (0)