[clang] [PowerPC] cleaned dead code of PPC.cpp and PPC.h (PR #130994)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 10:14:55 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: zhijian lin (diggerlin)

<details>
<summary>Changes</summary>

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
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:

``````````

</details>


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


More information about the cfe-commits mailing list