[llvm] [AMDGPU] Refine AMDGPUCodeGenPrepareImpl class. NFC. (PR #118461)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 05:15:37 PST 2024


================
@@ -95,42 +95,56 @@ static cl::opt<bool> DisableFDivExpand(
   cl::ReallyHidden,
   cl::init(false));
 
+static bool hasUnsafeFPMath(const Function &F) {
+  return F.getFnAttribute("unsafe-fp-math").getValueAsBool();
+}
+
 class AMDGPUCodeGenPrepareImpl
     : public InstVisitor<AMDGPUCodeGenPrepareImpl, bool> {
 public:
-  const GCNSubtarget *ST = nullptr;
-  const AMDGPUTargetMachine *TM = nullptr;
-  const TargetLibraryInfo *TLInfo = nullptr;
-  AssumptionCache *AC = nullptr;
-  DominatorTree *DT = nullptr;
-  UniformityInfo *UA = nullptr;
-  Module *Mod = nullptr;
-  const DataLayout *DL = nullptr;
-  bool HasUnsafeFPMath = false;
-  bool HasFP32DenormalFlush = false;
+  Function &F;
+  const GCNSubtarget &ST;
+  const AMDGPUTargetMachine &TM;
+  const TargetLibraryInfo *TLI;
+  AssumptionCache *AC;
+  const DominatorTree *DT;
+  const UniformityInfo &UA;
+  const DataLayout &DL;
+  bool HasUnsafeFPMath;
+  bool HasFP32DenormalFlush;
----------------
arsenm wrote:

```suggestion
  const bool HasUnsafeFPMath;
  const bool HasFP32DenormalFlush;
```

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


More information about the llvm-commits mailing list