https://llvm.org/bugs/show_bug.cgi?id=23459

            Bug ID: 23459
           Summary: MISched does not handle function arguments in tail
                    calling functions correctly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ cat test_tail_call_rol.c 

void callee2(void *a0, void *a1, void *a2, void *a3, void *a4, void *a5, void
*a6, void *a7, void *a8, void *a9, void *a10, void *a11, void *a12,
             void *a13, void *a14, void *a15, void *a16, void *a17, void *a18,
void *a19, void *a20, void *a21, void *a22, void *a23, void *a24, void *a25,
             void *a26, void *a27, void *a28, void *a29, void *a30, void *a31,
void *a32, void *a33);



void caller2(void *a0, void *a1, void *a2, void *a3, void *a4, void *a5, void
*a6, void *a7, void *a8, void *a9, void *a10, void *a11, void *a12,
            void *a13, void *a14, void *a15, void *a16, void *a17, void *a18,
void *a19, void *a20, void *a21, void *a22, void *a23, void *a24, void *a25,
            void *a26, void *a27, void *a28, void *a29, void *a30, void *a31,
void *a32, void *a33) {
  callee2(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
          a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25,
          a26, a27, a28, a29, a30, a31, a32, a33, a0);
}

$ bin/clang -target arm64-apple-ios -O test_tail_call_rol.c -S -o - -mllvm
--aarch64-load-store-opt=false

_caller2:                               ; @caller2
; BB#0:                                 ; %entry
        str     x0, [sp, #200] <== Upsy daisy we trashed the old value.
        ldr      x8, [sp]
        ldr     x9, [sp, #200]
...

The problem is two fold:
1.) MI->isInvariantLoad returns true for stack argument locations. This is not
true when we are tail calling. A tail call clobbers its incoming argument area.
2.) The code in ScheduleDAGInstrs::buildSchedGraph assumes that two distinct
PseudoSourceValues can't alias. For tail calls this assumption is again not
correct. Two FixedStackPseudoSourceValues can refer to the same location.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to