Duncan P. N. Exon Smith

Results comments of Duncan P. N. Exon Smith

> @dexonsmith BPI appears to handle zero branch weight case here: > > https://github.com/llvm/llvm-project/blob/74724902ba2fc0dc2734cdb5fae15cb338f1b635/llvm/lib/Analysis/BranchProbabilityInfo.cpp#L430-L434 > > Seems to be and old concern: [6a2c71a](https://github.com/llvm/llvm-project/commit/6a2c71af0bc5beebf954e1970233fbeb3be0bf1c) Perhaps that commit wasn't implemented fully, then!...

> It looks like BPI was handling the case of zero branch weight since at least 2015. I was planning to update another pass that didn't handle this case assuming...

> > Note the `volatile` qualifier was introduced in 7af3432e22b04 by @dexonsmith, as being a "gross hack" which I agree with. :) Duncan, would you agree that switching this function...

> I think it would make sense to add an assert here. I think it'd be better to return `std::nullopt` if `MaxLen` is 0. Can do this before the `strnlen`...

(Seems plausible that you could muck around with a binary header map to create a unit test for this... maybe store an empty string as the first entry, then truncate...