[PATCH] D140689: [llvm][dfsan] Enable loongarch64 and add `zeroext` attribute

Andrew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 27 10:17:36 PST 2022


browneee added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:299-306
+// loongarch64 Linux
+// NOLINTNEXTLINE(readability-identifier-naming)
+static const MemoryMapParams Linux_LoongArch64_MemoryMapParams = {
+    0,              // AndMask (not used)
+    0x500000000000, // XorMask
+    0,              // ShadowBase (not used)
+    0x100000000000, // OriginBase
----------------
Move this into D140690

All the other ZExt fixes in this file are unrelated to this.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1053-1055
+  Triple TargetTriple(I.getModule()->getTargetTriple());
+  if (TargetTriple.getArch() == Triple::loongarch64)
+    CI->addParamAttr(0, Attribute::ZExt);
----------------
I think the 8bit shadow variable arguments should be zext on any platform (this applies to all the ZExt changes in this file).


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1129-1134
+  if (TargetTriple.getArch() == Triple::x86_64)
+    MapParams = &Linux_X86_64_MemoryMapParams;
+  else if (TargetTriple.getArch() == Triple::loongarch64)
+    MapParams = &Linux_LoongArch64_MemoryMapParams;
+  else
     report_fatal_error("unsupported architecture");
----------------
Move this into D140690

All the other ZExt fixes in this file are unrelated to this.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1435
+  Triple TargetTriple(M.getTargetTriple());
+  AttributeList AL;
+  if (TargetTriple.getArch() == Triple::loongarch64)
----------------
Please use a separate AttributeList for each call, like in initializeRuntimeFunctions().


================
Comment at: llvm/test/Instrumentation/DataFlowSanitizer/callback-loongarch64.ll:1
+; RUN: opt < %s -passes=dfsan -dfsan-event-callbacks=1 -S | FileCheck %s
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
----------------
Move file to D140690.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140689



More information about the llvm-commits mailing list