[llvm-branch-commits] [clang] [llvm] [InstCombiner] Remove unused `llvm.experimental.hot()` (PR #84851)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 12 02:25:39 PDT 2024


================
@@ -2827,6 +2827,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         }))
       return nullptr;
     break;
+  case Intrinsic::experimental_hot: {
+    // The intrinsic declaration includes sideeffects to avoid it moved. This
+    // prevents removing even if the intrinsic is unused. We should remove
+    // unused ones to enabled other optimizations.
+    if (CI.use_empty())
+      return eraseInstFromFunction(CI);
----------------
nikic wrote:

This should be handled inside wouldInstructionBeTriviallyDead.

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


More information about the llvm-branch-commits mailing list