Skip to content

Conversation

diggerlin
Copy link
Contributor

There are some variables in the PPC.h which are defined and assigned a value to them,
but never be used, remove the code related to the variables.

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:PowerPC clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 12, 2025
@diggerlin diggerlin requested review from amy-kwan and RolandF77 March 12, 2025 17:14
@llvmbot
Copy link
Member

llvmbot commented Mar 12, 2025

@llvm/pr-subscribers-backend-powerpc

Author: zhijian lin (diggerlin)

Changes

There are some variables in the PPC.h which are defined and assigned a value to them,
but never be used, remove the code related to the variables.


Full diff: https://github.com/llvm/llvm-project/pull/130994.diff

2 Files Affected:

  • (modified) clang/lib/Basic/Targets/PPC.cpp (-42)
  • (modified) clang/lib/Basic/Targets/PPC.h (-14)
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 2d8891a739ca3..2441cb00dfdfc 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -46,18 +46,10 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasAltivec = true;
     } else if (Feature == "+vsx") {
       HasVSX = true;
-    } else if (Feature == "+crbits") {
-      UseCRBits = true;
-    } else if (Feature == "+bpermd") {
-      HasBPERMD = true;
-    } else if (Feature == "+extdiv") {
-      HasExtDiv = true;
     } else if (Feature == "+power8-vector") {
       HasP8Vector = true;
     } else if (Feature == "+crypto") {
       HasP8Crypto = true;
-    } else if (Feature == "+direct-move") {
-      HasDirectMove = true;
     } else if (Feature == "+htm") {
       HasHTM = true;
     } else if (Feature == "+float128") {
@@ -68,8 +60,6 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasP10Vector = true;
     } else if (Feature == "+pcrelative-memops") {
       HasPCRelativeMemops = true;
-    } else if (Feature == "+prefix-instrs") {
-      HasPrefixInstrs = true;
     } else if (Feature == "+spe" || Feature == "+efpu2") {
       HasStrictFP = false;
       HasSPE = true;
@@ -81,30 +71,12 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasFrsqrtes = true;
     } else if (Feature == "-hard-float") {
       FloatABI = SoftFloat;
-    } else if (Feature == "+paired-vector-memops") {
-      PairedVectorMemops = true;
     } else if (Feature == "+mma") {
       HasMMA = true;
     } else if (Feature == "+rop-protect") {
       HasROPProtect = true;
-    } else if (Feature == "+privileged") {
-      HasPrivileged = true;
-    } else if (Feature == "+aix-small-local-exec-tls") {
-      HasAIXSmallLocalExecTLS = true;
-    } else if (Feature == "+aix-small-local-dynamic-tls") {
-      HasAIXSmallLocalDynamicTLS = true;
-    } else if (Feature == "+isa-v206-instructions") {
-      IsISA2_06 = true;
-    } else if (Feature == "+isa-v207-instructions") {
-      IsISA2_07 = true;
-    } else if (Feature == "+isa-v30-instructions") {
-      IsISA3_0 = true;
-    } else if (Feature == "+isa-v31-instructions") {
-      IsISA3_1 = true;
     } else if (Feature == "+quadword-atomics") {
       HasQuadwordAtomics = true;
-    } else if (Feature == "+aix-shared-lib-tls-model-opt") {
-      HasAIXShLibTLSModelOpt = true;
     } else if (Feature == "+longcall") {
       UseLongCalls = true;
     }
@@ -745,31 +717,17 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const {
       .Case("powerpc", true)
       .Case("altivec", HasAltivec)
       .Case("vsx", HasVSX)
-      .Case("crbits", UseCRBits)
       .Case("power8-vector", HasP8Vector)
       .Case("crypto", HasP8Crypto)
-      .Case("direct-move", HasDirectMove)
       .Case("htm", HasHTM)
-      .Case("bpermd", HasBPERMD)
-      .Case("extdiv", HasExtDiv)
       .Case("float128", HasFloat128)
       .Case("power9-vector", HasP9Vector)
-      .Case("paired-vector-memops", PairedVectorMemops)
       .Case("power10-vector", HasP10Vector)
       .Case("pcrelative-memops", HasPCRelativeMemops)
-      .Case("prefix-instrs", HasPrefixInstrs)
       .Case("spe", HasSPE)
       .Case("mma", HasMMA)
       .Case("rop-protect", HasROPProtect)
-      .Case("privileged", HasPrivileged)
-      .Case("aix-small-local-exec-tls", HasAIXSmallLocalExecTLS)
-      .Case("aix-small-local-dynamic-tls", HasAIXSmallLocalDynamicTLS)
-      .Case("isa-v206-instructions", IsISA2_06)
-      .Case("isa-v207-instructions", IsISA2_07)
-      .Case("isa-v30-instructions", IsISA3_0)
-      .Case("isa-v31-instructions", IsISA3_1)
       .Case("quadword-atomics", HasQuadwordAtomics)
-      .Case("aix-shared-lib-tls-model-opt", HasAIXShLibTLSModelOpt)
       .Case("longcall", UseLongCalls)
       .Default(false);
 }
diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index db6ac6f0bd338..17057cef97a57 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -60,31 +60,17 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
   bool HasAltivec = false;
   bool HasMMA = false;
   bool HasROPProtect = false;
-  bool HasPrivileged = false;
-  bool HasAIXSmallLocalExecTLS = false;
-  bool HasAIXSmallLocalDynamicTLS = false;
   bool HasVSX = false;
-  bool UseCRBits = false;
   bool HasP8Vector = false;
   bool HasP8Crypto = false;
-  bool HasDirectMove = false;
   bool HasHTM = false;
-  bool HasBPERMD = false;
-  bool HasExtDiv = false;
   bool HasP9Vector = false;
   bool HasSPE = false;
   bool HasFrsqrte = false;
   bool HasFrsqrtes = false;
-  bool PairedVectorMemops = false;
   bool HasP10Vector = false;
   bool HasPCRelativeMemops = false;
-  bool HasPrefixInstrs = false;
-  bool IsISA2_06 = false;
-  bool IsISA2_07 = false;
-  bool IsISA3_0 = false;
-  bool IsISA3_1 = false;
   bool HasQuadwordAtomics = false;
-  bool HasAIXShLibTLSModelOpt = false;
   bool UseLongCalls = false;
 
 protected:

@llvmbot
Copy link
Member

llvmbot commented Mar 12, 2025

@llvm/pr-subscribers-clang

Author: zhijian lin (diggerlin)

Changes

There are some variables in the PPC.h which are defined and assigned a value to them,
but never be used, remove the code related to the variables.


Full diff: https://github.com/llvm/llvm-project/pull/130994.diff

2 Files Affected:

  • (modified) clang/lib/Basic/Targets/PPC.cpp (-42)
  • (modified) clang/lib/Basic/Targets/PPC.h (-14)
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 2d8891a739ca3..2441cb00dfdfc 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -46,18 +46,10 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasAltivec = true;
     } else if (Feature == "+vsx") {
       HasVSX = true;
-    } else if (Feature == "+crbits") {
-      UseCRBits = true;
-    } else if (Feature == "+bpermd") {
-      HasBPERMD = true;
-    } else if (Feature == "+extdiv") {
-      HasExtDiv = true;
     } else if (Feature == "+power8-vector") {
       HasP8Vector = true;
     } else if (Feature == "+crypto") {
       HasP8Crypto = true;
-    } else if (Feature == "+direct-move") {
-      HasDirectMove = true;
     } else if (Feature == "+htm") {
       HasHTM = true;
     } else if (Feature == "+float128") {
@@ -68,8 +60,6 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasP10Vector = true;
     } else if (Feature == "+pcrelative-memops") {
       HasPCRelativeMemops = true;
-    } else if (Feature == "+prefix-instrs") {
-      HasPrefixInstrs = true;
     } else if (Feature == "+spe" || Feature == "+efpu2") {
       HasStrictFP = false;
       HasSPE = true;
@@ -81,30 +71,12 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasFrsqrtes = true;
     } else if (Feature == "-hard-float") {
       FloatABI = SoftFloat;
-    } else if (Feature == "+paired-vector-memops") {
-      PairedVectorMemops = true;
     } else if (Feature == "+mma") {
       HasMMA = true;
     } else if (Feature == "+rop-protect") {
       HasROPProtect = true;
-    } else if (Feature == "+privileged") {
-      HasPrivileged = true;
-    } else if (Feature == "+aix-small-local-exec-tls") {
-      HasAIXSmallLocalExecTLS = true;
-    } else if (Feature == "+aix-small-local-dynamic-tls") {
-      HasAIXSmallLocalDynamicTLS = true;
-    } else if (Feature == "+isa-v206-instructions") {
-      IsISA2_06 = true;
-    } else if (Feature == "+isa-v207-instructions") {
-      IsISA2_07 = true;
-    } else if (Feature == "+isa-v30-instructions") {
-      IsISA3_0 = true;
-    } else if (Feature == "+isa-v31-instructions") {
-      IsISA3_1 = true;
     } else if (Feature == "+quadword-atomics") {
       HasQuadwordAtomics = true;
-    } else if (Feature == "+aix-shared-lib-tls-model-opt") {
-      HasAIXShLibTLSModelOpt = true;
     } else if (Feature == "+longcall") {
       UseLongCalls = true;
     }
@@ -745,31 +717,17 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const {
       .Case("powerpc", true)
       .Case("altivec", HasAltivec)
       .Case("vsx", HasVSX)
-      .Case("crbits", UseCRBits)
       .Case("power8-vector", HasP8Vector)
       .Case("crypto", HasP8Crypto)
-      .Case("direct-move", HasDirectMove)
       .Case("htm", HasHTM)
-      .Case("bpermd", HasBPERMD)
-      .Case("extdiv", HasExtDiv)
       .Case("float128", HasFloat128)
       .Case("power9-vector", HasP9Vector)
-      .Case("paired-vector-memops", PairedVectorMemops)
       .Case("power10-vector", HasP10Vector)
       .Case("pcrelative-memops", HasPCRelativeMemops)
-      .Case("prefix-instrs", HasPrefixInstrs)
       .Case("spe", HasSPE)
       .Case("mma", HasMMA)
       .Case("rop-protect", HasROPProtect)
-      .Case("privileged", HasPrivileged)
-      .Case("aix-small-local-exec-tls", HasAIXSmallLocalExecTLS)
-      .Case("aix-small-local-dynamic-tls", HasAIXSmallLocalDynamicTLS)
-      .Case("isa-v206-instructions", IsISA2_06)
-      .Case("isa-v207-instructions", IsISA2_07)
-      .Case("isa-v30-instructions", IsISA3_0)
-      .Case("isa-v31-instructions", IsISA3_1)
       .Case("quadword-atomics", HasQuadwordAtomics)
-      .Case("aix-shared-lib-tls-model-opt", HasAIXShLibTLSModelOpt)
       .Case("longcall", UseLongCalls)
       .Default(false);
 }
diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index db6ac6f0bd338..17057cef97a57 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -60,31 +60,17 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
   bool HasAltivec = false;
   bool HasMMA = false;
   bool HasROPProtect = false;
-  bool HasPrivileged = false;
-  bool HasAIXSmallLocalExecTLS = false;
-  bool HasAIXSmallLocalDynamicTLS = false;
   bool HasVSX = false;
-  bool UseCRBits = false;
   bool HasP8Vector = false;
   bool HasP8Crypto = false;
-  bool HasDirectMove = false;
   bool HasHTM = false;
-  bool HasBPERMD = false;
-  bool HasExtDiv = false;
   bool HasP9Vector = false;
   bool HasSPE = false;
   bool HasFrsqrte = false;
   bool HasFrsqrtes = false;
-  bool PairedVectorMemops = false;
   bool HasP10Vector = false;
   bool HasPCRelativeMemops = false;
-  bool HasPrefixInstrs = false;
-  bool IsISA2_06 = false;
-  bool IsISA2_07 = false;
-  bool IsISA3_0 = false;
-  bool IsISA3_1 = false;
   bool HasQuadwordAtomics = false;
-  bool HasAIXShLibTLSModelOpt = false;
   bool UseLongCalls = false;
 
 protected:

@diggerlin diggerlin requested review from daltenty and lei137 March 12, 2025 17:14
@diggerlin diggerlin changed the title [PowerPC] cleaned dead code of PPC.cpp and PPC.h [NFC][PowerPC] cleaned dead code of PPC.cpp and PPC.h Mar 12, 2025
Copy link
Collaborator

@hubert-reinterpretcast hubert-reinterpretcast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks.

@diggerlin diggerlin merged commit 737a0ae into llvm:main Mar 14, 2025
15 checks passed
@diggerlin diggerlin deleted the digger/clean-dead-code branch March 17, 2025 14:10
@diggerlin diggerlin changed the title [NFC][PowerPC] cleaned dead code of PPC.cpp and PPC.h [PowerPC] cleaned dead code of PPC.cpp and PPC.h Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants