[PATCH] [mips] For indirect calls we don't need $gp to point to .got.
Daniel Sanders
daniel.sanders at imgtec.com
Tue Sep 23 07:50:57 PDT 2014
================
Comment at: lib/Target/Mips/MipsISelLowering.cpp:2421
@@ -2416,1 +2420,3 @@
+ // function whose address is taken in the program).
+ if (IsPICCall && !InternalLinkage && GlobalOrExternal) {
unsigned GPReg = Subtarget.isABI_N64() ? Mips::GP_64 : Mips::GP;
----------------
I agree that this is equivalent, but is it possible to test for MO_GOT_CALL instead of the conditions that lead to choosing MO_GOT_CALL?
================
Comment at: test/CodeGen/Mips/prevent-hoisting.ll:13-26
@@ -12,13 +12,16 @@
-; The check for "addiu" instruction is added so that we can match the correct "b" instruction.
+; The check for first "addiu" instruction is added so that we can match the correct "b" instruction.
; CHECK: addiu ${{[0-9]+}}, $zero, -1
; CHECK: b $[[BB0:BB[0-9_]+]]
+; CHECK-NEXT: addiu ${{[0-9]+}}, $zero, 0
-; Check that sll instruction that writes to $1 starts basic block.
-; CHECK: {{BB[0-9_#]+}}:
+; Check that at the start of a fallthrough block there is a instruction that writes to $1.
+; CHECK-NEXT: {{BB[0-9_#]+}}:
+; CHECK-NEXT: lw $[[R1:[0-9]+]], %got(assignSE2partition)($[[R2:[0-9]+]])
; CHECK-NEXT: sll $1, $[[R0:[0-9]+]], 4
-; Check that identical sll instruction starts another basic block.
+; Check that identical instructions are at the start of a target block.
; CHECK: [[BB0]]:
+; CHECK-NEXT: lw $[[R1]], %got(assignSE2partition)($[[R2]])
; CHECK-NEXT: sll $1, $[[R0]], 4
----------------
This is just fixing up a test where the instructions changed order isn't it?
If so, I feel that there ought to be a more robust way of testing for this. This is close:
CHECK-NEXT: {{BB[0-9_#]+}}:
CHECK-DAG: sll $1, $[[R0:[0-9]+]], 4
CHECK: {{BB[0-9_#]+}}:
CHECK: [[BB0]]:
but there's no guarantee that there will be a second basic block between the two.
If neither of us can think of anything better, then we should go ahead with this change as-is and maintain it when necessary.
http://reviews.llvm.org/D5067
More information about the llvm-commits
mailing list