[PATCH] D115842: [llvm-profgen] Fix warning of enumerated and non-enumerated type in conditional expression

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 19:37:56 PST 2021


wlei created this revision.
Herald added subscribers: hoy, wenlei.
wlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115842

Files:
  llvm/tools/llvm-profgen/PerfReader.cpp


Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -9,6 +9,7 @@
 #include "ProfileGenerator.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Process.h"
+#include <bits/stdint-uintn.h>
 
 #define DEBUG_TYPE "perf-reader"
 
@@ -905,8 +906,8 @@
            "Branch' source should not be an external address, it should be "
            "converted to aritificial branch.");
     uint64_t SourceOffset = Binary->virtualAddrToOffset(LBR.Source);
-    uint64_t TargetOffset = LBR.Target == ExternalAddr
-                                ? ExternalAddr
+    uint64_t TargetOffset = LBR.Target == static_cast<uint64_t>(ExternalAddr)
+                                ? static_cast<uint64_t>(ExternalAddr)
                                 : Binary->virtualAddrToOffset(LBR.Target);
 
     if (!LBR.IsArtificial && TargetOffset != ExternalAddr) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115842.394728.patch
Type: text/x-patch
Size: 1001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211216/09afe325/attachment.bin>


More information about the llvm-commits mailing list