The following code would not work before this patch, due to the inability to take the address of a global object:

void func1() {

...
}

int main(int argc, char** argv) {

void (*pFunc)();
pFunc = &func1
pFunc();
...
}

Phabricator review: http://reviews.llvm.org/D19368

llvm-svn: 267120
This commit is contained in:
Chris Dewhurst 2016-04-22 08:13:47 +00:00
parent f8997cf5ae
commit 431fc8af7b
1 changed files with 1 additions and 1 deletions

View File

@ -296,7 +296,7 @@ void Filler::insertCallDefsUses(MachineBasicBlock::iterator MI,
RegUses.insert(Reg.getReg());
const MachineOperand &RegOrImm = MI->getOperand(1);
if (RegOrImm.isImm())
if (RegOrImm.isImm() || RegOrImm.isGlobal())
break;
assert(RegOrImm.isReg() && "CALLrr second operand is not a register.");
assert(RegOrImm.isUse() && "CALLrr second operand is not a use.");