[PATCH] Disable x86 tail call optimization under PIC mode

Chih-Hung Hsieh chh at google.com
Fri May 22 16:40:50 PDT 2015


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:2929
@@ -2928,3 @@
-    } else {
-      // If we are tail calling and generating PIC/GOT style code load the
-      // address of the callee into ECX. The value in ecx is used as target of
----------------
davidxl wrote:
> It is a valid optimization with eager binding, so it seems the behavior should be controlled by an option.
David, I suppose you prefer the default to have tail call optimization.
Then, we don't need to change llvm.
We can use -fno-optimize-sibling-calls now to turn off tail call optimization.
Or we can add another -fno-optimize-tail-calls.

I would rather llvm for x86 to play safe as gcc, with no tail call optimization by default.
Then we could have another option like -foptimize-tail-calls.

On the other hand, I think I should not remove line 2928 to 2943,
for they might be needed for IsMustTail functions.

http://reviews.llvm.org/D9799

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list