[llvm] [MergeFunc] Preserve observable function pointer identity (PR #213604)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 06:21:10 PDT 2026
================
@@ -964,11 +969,17 @@ int FunctionComparator::cmpBasicBlocks(const BasicBlock *BBL,
return Res;
if (needToCmpOperands) {
assert(InstL->getNumOperands() == InstR->getNumOperands());
+ const auto *CBL = dyn_cast<CallBase>(InstL);
+ const auto *CBR = dyn_cast<CallBase>(InstR);
for (unsigned i = 0, e = InstL->getNumOperands(); i != e; ++i) {
Value *OpL = InstL->getOperand(i);
Value *OpR = InstR->getOperand(i);
- if (int Res = cmpValues(OpL, OpR))
+ ValueComparisonKind Kind = ValueComparisonKind::Normal;
+ if (CBL && CBR && CBL->isCallee(&InstL->getOperandUse(i)) &&
+ CBR->isCallee(&InstR->getOperandUse(i)))
----------------
nikic wrote:
The second isCallee() check can be an assert.
https://github.com/llvm/llvm-project/pull/213604
More information about the llvm-commits
mailing list