[llvm] 781e5f0 - PowerPC: Avoid MCSymbol::isUnset

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 3 20:17:35 PDT 2025


Author: Fangrui Song
Date: 2025-08-03T20:17:31-07:00
New Revision: 781e5f0b5dc78305e5726d2118c1304f0229f36b

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

LOG: PowerPC: Avoid MCSymbol::isUnset

"unset" is not a meaningful separae state and it will be merged into
"undefined".

https://reviews.llvm.org/D72570 ported a GAS hack that moves the label
when a prefixed instruction on the same source line needs automatic
alignment. However, we can used isDefined instead of isUnset.

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index 2dbc31fce72c2..132d5a4a21adc 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -65,7 +65,7 @@ void PPCELFStreamer::emitPrefixedInstruction(const MCInst &Inst,
   MCFragment *InstructionFragment = getCurrentFragment();
   SMLoc InstLoc = Inst.getLoc();
   // Check if there was a last label emitted.
-  if (LastLabel && !LastLabel->isUnset() && LastLabelLoc.isValid() &&
+  if (LastLabel && LastLabel->isDefined() && LastLabelLoc.isValid() &&
       InstLoc.isValid()) {
     const SourceMgr *SourceManager = getContext().getSourceManager();
     unsigned InstLine = SourceManager->FindLineNumber(InstLoc);


        


More information about the llvm-commits mailing list