[llvm] a2505bd - [PowerPC][AIX] Override markFunctionEnd()

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 07:09:27 PST 2022


Author: Sean Fertile
Date: 2022-01-25T10:08:53-05:00
New Revision: a2505bd063e7949e2f0d892d85dec360fb28c702

URL: https://github.com/llvm/llvm-project/commit/a2505bd063e7949e2f0d892d85dec360fb28c702
DIFF: https://github.com/llvm/llvm-project/commit/a2505bd063e7949e2f0d892d85dec360fb28c702.diff

LOG: [PowerPC][AIX] Override markFunctionEnd()

During fast-isel calling 'markFunctionEnd' in the base class will call
tidyLandingPads. This can cause an issue where we have determined that
we need ehinfo and emitted a traceback table with the bits set to
indicate that we will be emitting the ehinfo, but the tidying deletes
all landing pads. In this case we end up emitting a reference to
__ehinfo.N symbol, but not emitting a definition to said symbol and the
resulting file fails to assemble.

Differential Revision: https://reviews.llvm.org/D117040

Added: 
    llvm/test/CodeGen/PowerPC/aix-ehinfo-sym.ll

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
    llvm/lib/CodeGen/AsmPrinter/DwarfException.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
index 964cef75d164f..03e63321e3c4d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
@@ -23,6 +23,8 @@ namespace llvm {
 
 AIXException::AIXException(AsmPrinter *A) : DwarfCFIExceptionBase(A) {}
 
+void AIXException::markFunctionEnd() { endFragment(); }
+
 void AIXException::emitExceptionInfoTable(const MCSymbol *LSDA,
                                           const MCSymbol *PerSym) {
   // Generate EH Info Table.

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.h b/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
index 40898c9fc8551..4defa8a30855e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
@@ -98,6 +98,8 @@ class LLVM_LIBRARY_VISIBILITY AIXException : public DwarfCFIExceptionBase {
 public:
   AIXException(AsmPrinter *A);
 
+  void markFunctionEnd() override;
+
   void endModule() override {}
   void beginFunction(const MachineFunction *MF) override {}
 

diff  --git a/llvm/test/CodeGen/PowerPC/aix-ehinfo-sym.ll b/llvm/test/CodeGen/PowerPC/aix-ehinfo-sym.ll
new file mode 100644
index 0000000000000..24ead04072f14
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/aix-ehinfo-sym.ll
@@ -0,0 +1,50 @@
+; RUN: llc -mtriple powerpc64-ibm-aix -verify-machineinstrs < %s | \
+; RUN:  FileCheck %s
+
+; RUN: llc -mtriple powerpc64-ibm-aix -fast-isel -verify-machineinstrs < %s | \
+; RUN:  FileCheck %s
+
+; Function Attrs: nounwind
+declare i32 @func1() #0
+
+declare i32 @__xlcxx_personality_v1(...)
+
+; Function Attrs: mustprogress noinline optnone
+define linkonce_odr void @func2() #1 align 2 personality i8* bitcast (i32 (...)* @__xlcxx_personality_v1 to i8*) {
+entry:
+  %0 = alloca i8*, align 8
+  %1 = alloca i32, align 4
+  br label %2
+
+2:                                                ; preds = %3, %entry
+  br i1 false, label %3, label %8
+
+3:                                                ; preds = %2
+  %4 = invoke i32 @func1()
+          to label %2 unwind label %lpad
+
+lpad:                                                ; preds = %3
+  %5 = landingpad { i8*, i32 }
+          cleanup
+  %6 = extractvalue { i8*, i32 } %5, 0
+  store i8* %6, i8** %0, align 8
+  %7 = extractvalue { i8*, i32 } %5, 1
+  store i32 %7, i32* %1, align 4
+  br label %eh.resume
+
+8:                                               ; preds = 2%
+  ret void
+
+eh.resume:                                               ; preds = %lpad
+  %9 = load i8*, i8** %0, align 8
+  %10 = load i32, i32* %1, align 4
+  %11 = insertvalue { i8*, i32 } undef, i8* %9, 0
+  %12 = insertvalue { i8*, i32 } %11, i32 %10, 1
+  resume { i8*, i32 } %12
+}
+
+attributes #0 = { nounwind }
+attributes #1 = { mustprogress noinline optnone }
+
+; CHECK: __ehinfo.0:
+; CHECK: .tc __ehinfo.0[TC],__ehinfo.0


        


More information about the llvm-commits mailing list