[mips] Make sure loads from lazy-binding entries do not get CSE'd or hoisted out
of loops. Previously, two consecutive calls to function "func" would result in the following sequence of instructions: 1. load $16, %got(func)($gp) // load address of lazy-binding stub. 2. move $25, $16 3. jalr $25 // jump to lazy-binding stub. 4. nop 5. move $25, $16 6. jalr $25 // jump to lazy-binding stub again. With this patch, the second call directly jumps to func's address, bypassing the lazy-binding resolution routine: 1. load $25, %got(func)($gp) // load address of lazy-binding stub. 2. jalr $25 // jump to lazy-binding stub. 3. nop 4. load $25, %got(func)($gp) // load resolved address of func. 5. jalr $25 // directly jump to func. llvm-svn: 191591
Showing
- llvm/lib/Target/Mips/Mips16ISelLowering.cpp 6 additions, 3 deletionsllvm/lib/Target/Mips/Mips16ISelLowering.cpp
- llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp 1 addition, 2 deletionsllvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
- llvm/lib/Target/Mips/MipsISelLowering.cpp 18 additions, 8 deletionsllvm/lib/Target/Mips/MipsISelLowering.cpp
- llvm/lib/Target/Mips/MipsISelLowering.h 8 additions, 6 deletionsllvm/lib/Target/Mips/MipsISelLowering.h
- llvm/test/CodeGen/Mips/brdelayslot.ll 9 additions, 2 deletionsllvm/test/CodeGen/Mips/brdelayslot.ll
- llvm/test/CodeGen/Mips/i64arg.ll 5 additions, 5 deletionsllvm/test/CodeGen/Mips/i64arg.ll
- llvm/test/CodeGen/Mips/largeimmprinting.ll 2 additions, 2 deletionsllvm/test/CodeGen/Mips/largeimmprinting.ll
- llvm/test/CodeGen/Mips/lazy-binding.ll 41 additions, 0 deletionsllvm/test/CodeGen/Mips/lazy-binding.ll
Loading
Please register or sign in to comment