tblah wrote: > I don't know about this. However, I wasn't aware mixing allocas and heap > allocations in the same block could cause issues, could you share an example > where that would be problematic? I see the benefit of splitting allocations > from initializations and other instructions, because it makes sure we don't > accidentally try to access memory before it has been defined, but that's not > something that would happen by interleaving heap allocation instructions > (they're not supposed to access any potential sibling allocas).
Yes I guess that's a point. It might be that the improvement here outweighs the disadvantage. As I understand it, it is best to create all allocas together because then it can all be reduced to a single addition/subtraction on the stack pointer instead of a series of them. Putting executable code (e.g. calls to heap allocators) might lead to there being several separate adjustments to the stack pointer. Also as I understand it, collecting allocas together (ideally at the start of the entry block, after we have done all of the outlining) is considered a more canonical form of LLVMIR (it is better than it used to be but we definitely don't achieve this in all cases currently). https://github.com/llvm/llvm-project/pull/154752 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits