[PATCH] D25293: Create llvm.addressofreturnaddress intrinsic

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 14:43:31 PDT 2016


rnk added inline comments.


================
Comment at: docs/LangRef.rst:9317
+
+Warning: It only works on x86 architecture.
+
----------------
I would just state this as a complete sentence:
  This intrinsic is only implemented for x86.


================
Comment at: lib/CodeGen/IntrinsicLowering.cpp:446
+    CI->replaceAllUsesWith(ConstantPointerNull::get(
+                                            cast<PointerType>(CI->getType())));
+    break;
----------------
is that what clang-format does?


================
Comment at: test/CodeGen/X86/addr-of-ret-addr.ll:8
+	ret i8* %0
+	; CHECK-X86: movl    %esp, %ebp
+	; CHECK-X86: leal    4(%ebp), %eax
----------------
Use CHECK-LABEL, and check for the pushl and pushq for x86 and x64 respectively. That's where we get the 4 and 8 offsets from.


================
Comment at: test/CodeGen/X86/win64_frame.ll:187
 
+define i8* @f11() "no-frame-pointer-elim"="true" {
+  ; CHECK-LABEL: f11:
----------------
agutowski wrote:
> majnemer wrote:
> > What happens if the frame pointer is eliminated? The return address should just be at %([re]sp) no?
> Yes, added test for that too.
Can you check for pushq and CHECK-NOT for push in f12?


https://reviews.llvm.org/D25293





More information about the llvm-commits mailing list