[PATCH] Refactor sameNoopInput (determining tail-call legitimacy)

Evan Cheng evan.cheng at apple.com
Fri Aug 2 11:58:54 PDT 2013


I'm not crazy about allowTruncateForTailCalls(). IMHO, in general we should avoid adding *very specific* target hooks like this. If a target hook is absolutely required (looks like it is here), then we should at least try to make it more general so it may be useful for other optimizations. Do you think that's possible here?

Evan

On Jul 31, 2013, at 5:31 AM, Tim Northover <t.p.northover at gmail.com> wrote:

>  Following Stephen's suggestion, I've added a TargetLowering function "allowTruncateForTailCalls" to replace the isTruncateFree call. Only three targets defined this before, so to be on the safe side I've only considered those three:
> 
>  * X86 allows all truncates from 64-bit downwards (and relies on the previous code weeding out zeroext/signext attributes).
>  * MSP430 didn't support tail calls anyway, so I left it at the default "nope".
>  * Hexagon seems like it would allow truncates from i32 in general, and from i64 in its current guise. I've limited it to i32 due to fragility concerns.
> 
>  This patch may have to change further if Nick's proposed weakening of the "no zeroext/signext" rule is accepted. I'll update it (with more tests) if that happens before this is committed.
> 
> http://llvm-reviews.chandlerc.com/D1216
> 
> CHANGE SINCE LAST DIFF
>  http://llvm-reviews.chandlerc.com/D1216?vs=2999&id=3103#toc
> 
> Files:
>  include/llvm/Target/TargetLowering.h
>  lib/CodeGen/Analysis.cpp
>  lib/Target/Hexagon/HexagonISelLowering.cpp
>  lib/Target/Hexagon/HexagonISelLowering.h
>  lib/Target/X86/X86ISelLowering.cpp
>  lib/Target/X86/X86ISelLowering.h
>  test/CodeGen/Hexagon/tail-call-trunc.ll
>  test/CodeGen/X86/returned-trunc-tail-calls.ll
>  test/CodeGen/X86/tail-call-legality.ll
> <D1216.2.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list