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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 10:57:28 PDT 2016


Why not add a testcase?

Cheers,
Rafael


On 22 April 2016 at 04:13, Chris Dewhurst via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> 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.");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list