[llvm] 3da0aee - [NFC] Use hasSection instead of getSection().empty()

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 23 10:01:27 PDT 2021


Author: Snehasish Kumar
Date: 2021-04-23T10:00:38-07:00
New Revision: 3da0aeea080f84ebc5e3059403f799469b93b773

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

LOG: [NFC] Use hasSection instead of getSection().empty()

Use the optimized check hasSection() instead of calling
getSection().empty(). Originally suggested in D101004, but was dropped
in the commit.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineFunctionSplitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
index 2bb69e0ed700..0e0eb8b8e00f 100644
--- a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
@@ -101,7 +101,7 @@ bool MachineFunctionSplitter::runOnMachineFunction(MachineFunction &MF) {
   // since the split part may not be placed in a contiguous region. It may also
   // be more beneficial to augment the linker to ensure contiguous layout of
   // split functions within the same section as specified by the attribute.
-  if (!MF.getFunction().getSection().empty() ||
+  if (MF.getFunction().hasSection() ||
       MF.getFunction().hasFnAttribute("implicit-section-name"))
     return false;
 


        


More information about the llvm-commits mailing list