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

Chris Dewhurst via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 01:13:48 PDT 2016


Author: lerochris
Date: Fri Apr 22 03:13:47 2016
New Revision: 267120

URL: http://llvm.org/viewvc/llvm-project?rev=267120&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Target/Sparc/DelaySlotFiller.cpp

Modified: llvm/trunk/lib/Target/Sparc/DelaySlotFiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/DelaySlotFiller.cpp?rev=267120&r1=267119&r2=267120&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/DelaySlotFiller.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/DelaySlotFiller.cpp Fri Apr 22 03:13:47 2016
@@ -296,7 +296,7 @@ void Filler::insertCallDefsUses(MachineB
     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.");




More information about the llvm-commits mailing list