Auto merge of #122567 - erikdesjardins:noname, r= · rust-lang/rust@6034f04 (original) (raw)

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -155,8 +155,14 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
155 155
156 156 fn append_block(cx: &'a CodegenCx<'ll, 'tcx>, llfn: &'ll Value, name: &str) -> &'ll BasicBlock {
157 157 unsafe {
158 -let name = SmallCStr::new(name);
159 - llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, name.as_ptr())
158 +let c_str_name;
159 +let name_ptr = if cx.tcx.sess.fewer_names() {
160 +const { c"".as_ptr().cast() }
161 +} else {
162 + c_str_name = SmallCStr::new(name);
163 + c_str_name.as_ptr()
164 +};
165 + llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, name_ptr)
160 166 }
161 167 }
162 168
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
11 11 #![feature(exact_size_is_empty)]
12 12 #![feature(extern_types)]
13 13 #![feature(hash_raw_entry)]
14 +#![feature(inline_const)]
14 15 #![feature(iter_intersperse)]
15 16 #![feature(let_chains)]
16 17 #![feature(impl_trait_in_assoc_type)]
Original file line number Diff line number Diff line change
@@ -1688,7 +1688,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1688 1688 pub fn try_llbb(&mut self, bb: mir::BasicBlock) -> OptionBx::BasicBlock\ {
1689 1689 match self.cached_llbbs[bb] {
1690 1690 CachedLlbb::None => {
1691 -// FIXME(eddyb) only name the block if `fewer_names` is `false`.
1692 1691 let llbb = Bx::append_block(self.cx, self.llfn, &format!("{bb:?}"));
1693 1692 self.cached_llbbs[bb] = CachedLlbb::Some(llbb);
1694 1693 Some(llbb)