4 ms·
Some speculation about why Apple is deprecating bitcode in this SO post: https://stackoverflow.com/questions/72543728/xcode-14-deprecates-bitcode-but-why https:
by ridiculous_fish 4y ago
Some speculation about why Apple is deprecating bitcode in this SO post: https://stackoverflow.com/questions/72543728/xcode-14-deprecates-bitcode-but-why https://stackoverflow.com/questions/72543728/xcode-14-deprec...
- 0x0 4y agoBitcode could never really help with big architecture changes, there's too many #ifdef / #define'd integers and enums that have different values on different platforms, which would cause platform-specific integer values to be embedded hardcoded in the bitcode
- newaccount74 4y agoI'm pretty sure the SO answer is (partially) wrong. As far as I understand, Bitcode is not architecture agnostic, you can't just take bitcode from a 32bit compilation and turn it into a 64bit executable since there still are a ton of architecture dependent things (like memory alignment) in the bitcode.
- lilyball 4y agoThat's true. However it is microarchitecture agnostic.
- throw10920 4y agoIsn't machine code also microarchitecture agnostic? I thought that the definition of a microarchitecture was a particular implementation of an ISA that externally conformed to the ISA in the same way as any other microarchitecture.
- valleyer 4y agoMostly, yeah. But microarchitectures do sometimes add new instruction set extensions, like how Intel's Skylake added AVX-512. Bitcode can be re-lowered to the new extended ISA to use these instructions (assuming you don't need to target earlier uarchs). Machine code, not as easily (and I don't think anyone really tries, though I'd be interested to learn if someone does).
- legulere 4y agoLatency of instructions, number of ALUs and FPUs and available special functions differ from micro architecture to micro architecture. This makes the compiler behave differently in instruction selection when you select different micro architectures. With llvm-mca you can check how each micro architecture will behave differently for the same machine code: https://llvm.org/docs/CommandGuide/llvm-mca.html https://llvm.org/docs/CommandGuide/llvm-mca.html
- throw10920 4y agoOf course, implementation details are different between microarchitectures - that's the definition, after all. However, "agnostic" usually means that behavior doesn't vary. Performance is orthogonal to behavior in this case. I definitely don't expect code optimized for Haswell to be as fast on a Broadwell as code optimized for Broadwell, but I do at least expect it to run.
- pjmlp 4y agoThis is told a lot, because people keep missing the point that Apple has their own form of it, they don't use raw LLVM bitcode. See WWDC talk about watchOS migration to 64 bits.
- astrange 4y agoYes, this answer is wrong. LLVM IR is not generic; not only can you not recompile to new architectures, it's not always true that it doesn't care what the original language was. (Since it needs to know the aliasing/memory model rules of the original language, sometimes you need new versions of bitcode to handle new languages.) It's generic for a little while as long as things don't change too much, but eventually they do.
- bc-lee 4y agoI am one of the answerers to the SO question mentioned in this thread. With the end of support for the Apple Watch Series 3 (armv7k abi), I guess it was discontinued by Apple as they no longer needed Bitcode. Is there something I misunderstood?
- newaccount74 4y agoThis part is definitely wrong: > I may compile a C code to Bitcode and have LLVM generate a running binary for x86 CPUs in the end. If I save the Bitcode, however, I can later on tell LLVM to also create a running binary for an ARM CPU from that Bitcode, without having to compile anything and without access to the original C code. And the generated ARM code will be as good as if I had compiled to ARM from the very start. There is some other stuff in the answer that is interesting (eg. that Apple apparently never actually used Bitcode for iOS, despite what they implied) My guess is that they planned to use Bitcode to do minor optimisations for new generations of their chips, but it turned out to not work in practice, and so they scrapped it.
- bc-lee 4y agoThanks. Paragraphs you quoted are not a part of my answer.
- lgg 4y agoThe post's fundamental premise is wrong. LLVM bitcode is not architecture agnostic and never has been. Apple also has used it once, to move from 32 bit to 64 bit on watchOS. That was possible, but only because the armv7k and arm64_32 ABIs were developed together to ensure it would work.
- pjmlp 4y agoAnd because Apple's own customisations to LLVM bitcode.
- saagarjha 4y agoNo.
- pjmlp 4y agoNot an answer.
- saagarjha 4y agoYou’re wrong, not much more to it?
- pjmlp 4y agoProve it.
- saagarjha 4y agoThere are several people in this thread in positions to know who have already responded in the negative.
- pjmlp 4y ago1 - Everyone that follows clang development, knows that Apple's use of LLVM bitcode isn't what regular people get out of https://releases.llvm.org/download.html https://releases.llvm.org/download.html 2 - "You say, I say", school playground stuff, unless you actually have something to show beyond yes and no words.
- deleted 4y ago[deleted]