[llvm] [CoverageMapping] Avoid use of pow() resulting in solaris build fail (PR #75559)

Alan Phipps via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 21:46:07 PST 2023


https://github.com/evodius96 created https://github.com/llvm/llvm-project/pull/75559

Fixes a build failure introduced by
commit 8ecbb0404d74 ("Reland [Coverage][llvm-cov]
Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)")

Use of pow() is not necessary.

>From 8f33990893cd23c2021e0edf044b7f85d716348e Mon Sep 17 00:00:00 2001
From: Alan Phipps <a-phipps at ti.com>
Date: Thu, 14 Dec 2023 23:21:13 -0600
Subject: [PATCH] [CoverageMapping] Avoid use of pow() which results in solaris
 build failure

Fixes a build failure introduced by
commit 8ecbb0404d74 ("Reland [Coverage][llvm-cov]
Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)")
---
 llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 80875702b02ab9..eece6a2cc71797 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -281,7 +281,7 @@ class MCDCRecordProcessor {
       : ExecutedTestVectorBitmap(Bitmap), Region(Region), Branches(Branches),
         NumConditions(Region.MCDCParams.NumConditions),
         Folded(NumConditions, false), IndependencePairs(NumConditions),
-        TestVectors(pow(2, NumConditions)) {}
+        TestVectors((size_t)1 << NumConditions) {}
 
 private:
   void recordTestVector(MCDCRecord::TestVector &TV,



More information about the llvm-commits mailing list