Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inliner] Check number of operands in AddReturnAttributes #87093

Closed

Commits on Mar 29, 2024

  1. [Inliner] Check number of operands in AddReturnAttributes

    The commit 2da4960 enabled `noundef` attributes propagation. It looks
    like ret void is considered to be `noundef` thus `ValidUB.hasAttributes`
    now returns true for this type of instructions and everything proceed
    further to work with operands. The issue is that such instruction
    doesn't have operands, which means when accessing `RI->getOperand(0)`
    inliner pass crashes with an assert:
    
        llvm/include/llvm/IR/Instructions.h:3420: llvm::Value* llvm::ReturnInst::getOperand(unsigned int) const:
        Assertion `i_nocapture < OperandTraits<ReturnInst>::operands(this) && "getOperand() out of range!"' failed.
    
    Fix that by verifying if the ReturnInst in fact has some operands to
    process.
    
    Fixes llvm#86163
    erthalion committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    957ba82 View commit details
    Browse the repository at this point in the history