[PATCH] D75187: [AMDGPU][ConstantFolding] Fold llvm.amdgcn.cube* intrinsics

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 14:02:24 PST 2020


arsenm added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2311
+static APFloat ConstantFoldAMDGCNCubeIntrinsic(Intrinsic::ID IntrinsicID,
+                                               APFloat S0, APFloat S1,
+                                               APFloat S2) {
----------------
const references


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2317-2320
+  auto GreaterEqual = [](APFloat A, APFloat B) -> bool {
+    APFloat::cmpResult Res = A.compare(B);
+    return Res == APFloat::cmpGreaterThan || Res == APFloat::cmpEqual;
+  };
----------------
This can use const references and can be moved to a separate function since there's no local captures


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2381-2383
+        APFloat V1 = Op1->getValueAPF();
+        APFloat V2 = Op2->getValueAPF();
+        APFloat V3 = Op3->getValueAPF();
----------------
Avoid the copy by sinking thees to the uses


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75187/new/

https://reviews.llvm.org/D75187





More information about the llvm-commits mailing list