diff options
author | Maksim Panchenko <maks@fb.com> | 2024-06-27 17:26:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 17:26:58 -0700 |
commit | ca06b610841c849eb1db43ad057310c8f7eea81e (patch) | |
tree | fa1a14f1e4e28b40c725a961696e759163777148 | |
parent | c63eaddb629aa8d016b26c9c60c92aa5dcae3b43 (diff) | |
download | llvm-ca06b610841c849eb1db43ad057310c8f7eea81e.zip llvm-ca06b610841c849eb1db43ad057310c8f7eea81e.tar.gz llvm-ca06b610841c849eb1db43ad057310c8f7eea81e.tar.bz2 |
[BOLT] Omit CFI state while printing functions without CFI (#96723)
If a function has no CFI program attached to it, do not print redundant
empty CFI state for every basic block.
-rw-r--r-- | bolt/lib/Core/BinaryFunction.cpp | 4 | ||||
-rw-r--r-- | bolt/test/X86/issue20.s | 1 | ||||
-rw-r--r-- | bolt/test/X86/issue20.test | 1 | ||||
-rw-r--r-- | bolt/test/X86/sctc-bug4.test | 5 |
4 files changed, 2 insertions, 9 deletions
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index c608ff4..5d33aa6 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -543,7 +543,7 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) { else OS << "<unknown>\n"; } - if (BB->getCFIState() >= 0) + if (hasCFI()) OS << " CFI State : " << BB->getCFIState() << '\n'; if (opts::EnableBAT) { OS << " Input offset: 0x" << Twine::utohexstr(BB->getInputOffset()) @@ -611,7 +611,7 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) { } // In CFG_Finalized state we can miscalculate CFI state at exit. - if (CurrentState == State::CFG) { + if (CurrentState == State::CFG && hasCFI()) { const int32_t CFIStateAtExit = BB->getCFIStateAtExit(); if (CFIStateAtExit >= 0) OS << " CFI State: " << CFIStateAtExit << '\n'; diff --git a/bolt/test/X86/issue20.s b/bolt/test/X86/issue20.s index 99a4f2e..9645eaf 100644 --- a/bolt/test/X86/issue20.s +++ b/bolt/test/X86/issue20.s @@ -13,7 +13,6 @@ # CHECK-NOT: BOLT-INFO: UCE removed {{.*}} blocks and {{.*}} bytes of code # CHECK: Binary Function "main" # CHECK: .LFT{{.*}} (2 instructions, align : 1) -# CHECK-NEXT: CFI State : 0 # CHECK-NEXT: 00000004: andq # CHECK-NEXT: 00000008: jmpq # CHECK-NEXT: Successors: .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}} diff --git a/bolt/test/X86/issue20.test b/bolt/test/X86/issue20.test index dcb1ce5..09f9c36 100644 --- a/bolt/test/X86/issue20.test +++ b/bolt/test/X86/issue20.test @@ -9,7 +9,6 @@ CHECK-NOT: BOLT-INFO: UCE removed {{.*}} blocks and {{.*}}| bytes of code CHECK: Binary Function "main" CHECK: .LFT0 (2 instructions, align : 1) -CHECK-NEXT: CFI State : 0 CHECK-NEXT: 00000004: andq CHECK-NEXT: 00000008: jmpq CHECK-NEXT: Successors: .Ltmp1, .Ltmp2, .Ltmp3, .Ltmp4 diff --git a/bolt/test/X86/sctc-bug4.test b/bolt/test/X86/sctc-bug4.test index 21a602b..e192a23 100644 --- a/bolt/test/X86/sctc-bug4.test +++ b/bolt/test/X86/sctc-bug4.test @@ -6,24 +6,19 @@ RUN: llvm-bolt %t -o %t.null --enable-bat \ RUN: -funcs=test_func -print-sctc -sequential-disassembly 2>&1 | FileCheck %s CHECK: .Ltmp2 (3 instructions, align : 1) -CHECK-NEXT: CFI State : 0 CHECK-NEXT: Input offset: 0x24 CHECK-NEXT: Predecessors: .LFT1 CHECK-NEXT: 00000024: cmpq $0x20, %rsi CHECK-NEXT: 00000028: ja dummy # TAILCALL # Offset: 53 # CTCTakenCount: 0 CHECK-NEXT: 0000002a: jmp .Ltmp4 CHECK-NEXT: Successors: .Ltmp4 -CHECK-NEXT: CFI State: 0 CHECK: .Ltmp1 (2 instructions, align : 1) -CHECK-NEXT: CFI State : 0 CHECK-NEXT: Input offset: 0x2c CHECK-NEXT: Predecessors: .LFT0 CHECK-NEXT: 0000002c: xorq %r11, %rax CHECK-NEXT: 0000002f: retq -CHECK-NEXT: CFI State: 0 CHECK: .Ltmp4 (4 instructions, align : 1) -CHECK-NEXT: CFI State : 0 CHECK-NEXT: Input offset: 0x3a CHECK-NEXT: Predecessors: .Ltmp2 |