[llvm-branch-commits] [llvm] 522b906 - Revert "[hwasan] Update dbg.assign intrinsics in HWAsan pass"
Author: Orlando Cazalet-Hyams Date: 2024-01-22T13:30:24Z New Revision: 522b90654eb94898ebd30944fa8046df81816894 URL: https://github.com/llvm/llvm-project/commit/522b90654eb94898ebd30944fa8046df81816894 DIFF: https://github.com/llvm/llvm-project/commit/522b90654eb94898ebd30944fa8046df81816894.diff LOG: Revert "[hwasan] Update dbg.assign intrinsics in HWAsan pass" Added: Modified: llvm/lib/IR/DebugInfo.cpp llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp llvm/test/DebugInfo/Generic/assignment-tracking/declare-to-assign/hwasan.ll Removed: llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll llvm/test/CodeGen/AArch64/dbg-assign-tag-offset.ll llvm/test/Instrumentation/HWAddressSanitizer/dbg-assign-tag-offset.ll diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 2e64d0db57b259..fcd3f77f8f6e2b 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -2200,6 +2200,10 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) { if (F.hasFnAttribute(Attribute::OptimizeNone)) return /*Changed*/ false; + // FIXME: https://github.com/llvm/llvm-project/issues/76545 + if (F.hasFnAttribute(Attribute::SanitizeHWAddress)) +return /*Changed*/ false; + bool Changed = false; auto *DL = &F.getParent()->getDataLayout(); // Collect a map of {backing storage : dbg.declares} (currently "backing diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp index b213915dbcf624..efb621cde90656 100644 --- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -1435,11 +1435,6 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo, if (DDI->getVariableLocationOp(LocNo) == AI) DDI->setExpression(DIExpression::appendOpsToArg(DDI->getExpression(), NewOps, LocNo)); - if (auto *DAI = dyn_cast(DDI)) { -assert(DAI->getAddress() == AI); -DAI->setAddressExpression( -DIExpression::prependOpcodes(DDI->getExpression(), NewOps)); - } } auto TagEnd = [&](Instruction *Node) { diff --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp index d2efcde5d38032..f94047633022ca 100644 --- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp +++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp @@ -138,20 +138,16 @@ void StackInfoBuilder::visit(Instruction &Inst) { return; } if (auto *DVI = dyn_cast(&Inst)) { -auto AddIfInteresting = [&](Value *V) { +for (Value *V : DVI->location_ops()) { if (auto *AI = dyn_cast_or_null(V)) { if (!isInterestingAlloca(*AI)) - return; + continue; AllocaInfo &AInfo = Info.AllocasToInstrument[AI]; auto &DVIVec = AInfo.DbgVariableIntrinsics; if (DVIVec.empty() || DVIVec.back() != DVI) DVIVec.push_back(DVI); } -}; -for (Value *V : DVI->location_ops()) - AddIfInteresting(V); -if (auto *DAI = dyn_cast(DVI)) - AddIfInteresting(DAI->getAddress()); +} } Instruction *ExitUntag = getUntagLocationIfFunctionExit(Inst); if (ExitUntag) diff --git a/llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll b/llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll deleted file mode 100644 index ef0dd46cb45c7f..00 --- a/llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll +++ /dev/null @@ -1,71 +0,0 @@ -; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s - -;; Similar to dbg-assign-tag-offset.ll except the variable 'x' has been removed -;; and 'y' has an implicit location range as well as stack location range -;; (according to the hand-modified debug info -- see the dbg.value). - -target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -target triple = "aarch64-unknown-linux-android24" - -; CHECK: DW_TAG_variable -; CHECK-NOT: DW_TAG -; CHECK:DW_AT_LLVM_tag_offset (0x80) -; CHECK-NEXT: DW_AT_name("y") - -define dso_local void @f() !dbg !14 { - %1 = alloca i32, align 4, !DIAssignID !31 - %2 = alloca i32, align 4, !DIAssignID !32 - call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !32, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22 - call void @llvm.dbg.value(metadata i32 2, metadata !20, metadata !DIExpression()), !dbg !22 - call void @use(ptr null), !dbg !28 - store i32 1, ptr %2, align 4, !dbg !23, !tbaa !24, !DIAssignID !33 - call void @llvm.dbg.assign(metadata i32 1, metadata !20, metadata !DIExpression(), metadata !33, metadata ptr %2, metadata
[llvm-branch-commits] [libc] 0fdd731 - Revert "[libc] `FPRep` builders return `FPRep` instead of raw `StorageType`"
Author: Guillaume Chatelet Date: 2024-01-22T15:04:34+01:00 New Revision: 0fdd73163739c71e0ea14241cd0233a4d2065252 URL: https://github.com/llvm/llvm-project/commit/0fdd73163739c71e0ea14241cd0233a4d2065252 DIFF: https://github.com/llvm/llvm-project/commit/0fdd73163739c71e0ea14241cd0233a4d2065252.diff LOG: Revert "[libc] `FPRep` builders return `FPRep` instead of raw `StorageType`" Added: Modified: libc/src/__support/FPUtil/FPBits.h libc/test/src/__support/FPUtil/fpbits_test.cpp Removed: diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h index bc6b19b6ebf1089..be700285de82854 100644 --- a/libc/src/__support/FPUtil/FPBits.h +++ b/libc/src/__support/FPUtil/FPBits.h @@ -64,46 +64,38 @@ LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false); // └─▲─┘ // │ // ┌─┴─┐ -// │ FPStorage │ +// │ FPRepBase │ // └─▲─┘ // │ // ┌┴─┐ // │ │ -// ┌┴─┐ ┌──┴──┐ -// │ FPRepSem │ │ FPRepSem │ │ FPRep │ -// └───┘ -// │ -// ┌─┴─┐ // │ FPBits │ // └───┘ // -// - 'FPLayout' defines only a few constants, namely the 'StorageType' and -// length of the sign, the exponent, fraction and significand parts. -// - 'FPStorage' builds more constants on top of those from 'FPLayout' like -// exponent bias and masks. It also holds the bit representation of the -// floating point as a 'StorageType' type and defines tools to assemble or test +// - 'FPLayout' defines only a few constants, namely the 'StorageType' and the +// length of the sign, the exponent and significand parts. +// - 'FPRepBase' builds more constants on top of those from 'FPLayout' like +// exponent bias, shifts and masks. It also defines tools to assemble or test // these parts. -// - 'FPRepSem' defines functions to interact semantically with the floating -// point representation. The default implementation is the one for 'IEEE754', a -// specialization is provided for X86 Extended Precision. -// - 'FPRep' derives from 'FPRepSem' and adds functions that are common to all -// implementations. -// - 'FPBits' exposes all functions from 'FPRep' but operates on the native C++ -// floating point type instead of 'FPType'. +// - 'FPRep' defines functions to interact with the floating point +// representation. The default implementation is the one for 'IEEE754', a +// specialization is provided for X86 Extended Precision that has a diff erent +// encoding. +// - 'FPBits' is templated on the platform floating point types. Contrary to +// 'FPRep' that is platform agnostic 'FPBits' is architecture dependent. namespace internal { // Defines the layout (sign, exponent, significand) of a floating point type in // memory. It also defines its associated StorageType, i.e., the unsigned // integer type used to manipulate its representation. -// Additionally we provide the fractional part length, i.e., the number of bits -// after the decimal dot when the number is in normal form. template struct FPLayout {}; template <> struct FPLayout { @@ -111,7 +103,6 @@ template <> struct FPLayout { LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1; LIBC_INLINE_VAR static constexpr int EXP_LEN = 5; LIBC_INLINE_VAR static constexpr int SIG_LEN = 10; - LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SIG_LEN; }; template <> struct FPLayout { @@ -119,7 +110,6 @@ template <> struct FPLayout { LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1; LIBC_INLINE_VAR static constexpr int EXP_LEN = 8; LIBC_INLINE_VAR static constexpr int SIG_LEN = 23; - LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SIG_LEN; }; template <> struct FPLayout { @@ -127,7 +117,6 @@ template <> struct FPLayout { LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1; LIBC_INLINE_VAR static constexpr int EXP_LEN = 11; LIBC_INLINE_VAR static constexpr int SIG_LEN = 52; - LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SIG_LEN; }; template <> struct FPLayout { @@ -135,7 +124,6 @@ template <> struct FPLayout { LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1; LIBC_INLINE_VAR static constexpr int EXP_LEN = 15; LIBC_INLINE_VAR static constexpr int SIG_LEN = 112; - LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SIG_LEN; }; template <> struct FPLayout { @@ -143,22 +131,23 @@ template <> struct FPLayout { LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1; LIBC_INLINE_VAR static constexpr int EXP_LEN = 15; LIBC_INLINE_VAR static constexpr int SIG_LEN = 64; - LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SIG_LEN - 1; }; -// FPStorag
[llvm-branch-commits] [compiler-rt] format (PR #79009)
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/79009 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] format (PR #79009)
llvmbot wrote: @llvm/pr-subscribers-compiler-rt-sanitizer Author: Fangrui Song (MaskRay) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/79009.diff 1 Files Affected: - (modified) compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp (+4-2) ``diff diff --git a/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp b/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp index bf84ab3d20d7de..0967b34dc7dbfe 100644 --- a/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp +++ b/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp @@ -25,12 +25,14 @@ __attribute__((noinline)) void foo(int len) { char x; top = &x; volatile char array[len]; - if (len) array[0] = 0; + if (len) +array[0] = 0; assert(!(reinterpret_cast(array) & 31L)); alloca(len); for (int i = 0; i < 32; ++i) { volatile char array[i]; -if (i) array[0] = 0; +if (i) + array[0] = 0; bot = alloca(i); assert(!(reinterpret_cast(bot) & 31L)); } `` https://github.com/llvm/llvm-project/pull/79009 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] format (PR #79009)
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/79009 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] c1ad320 - Revert "[lli] Revisit Orc debug output tests"
Author: Mehdi Amini Date: 2024-01-22T12:53:58-08:00 New Revision: c1ad320450ef14443cd6c0f0ff3622fdd399778e URL: https://github.com/llvm/llvm-project/commit/c1ad320450ef14443cd6c0f0ff3622fdd399778e DIFF: https://github.com/llvm/llvm-project/commit/c1ad320450ef14443cd6c0f0ff3622fdd399778e.diff LOG: Revert "[lli] Revisit Orc debug output tests" Added: llvm/test/ExecutionEngine/OrcLazy/debug-descriptor-elf-minimal.ll llvm/test/ExecutionEngine/OrcLazy/debug-objects-elf-minimal.ll llvm/tools/lli/ExecutionUtils.cpp llvm/tools/lli/ExecutionUtils.h Modified: llvm/tools/lli/CMakeLists.txt llvm/tools/lli/lli.cpp Removed: llvm/test/ExecutionEngine/OrcLazy/debug-descriptor.ll llvm/test/ExecutionEngine/OrcLazy/debug-objects.ll diff --git a/llvm/test/ExecutionEngine/OrcLazy/debug-descriptor.ll b/llvm/test/ExecutionEngine/OrcLazy/debug-descriptor-elf-minimal.ll similarity index 53% rename from llvm/test/ExecutionEngine/OrcLazy/debug-descriptor.ll rename to llvm/test/ExecutionEngine/OrcLazy/debug-descriptor-elf-minimal.ll index bf7f13fb5439f72..9bac3897864f723 100644 --- a/llvm/test/ExecutionEngine/OrcLazy/debug-descriptor.ll +++ b/llvm/test/ExecutionEngine/OrcLazy/debug-descriptor-elf-minimal.ll @@ -1,17 +1,29 @@ -; REQUIRES: native && target-x86_64 +; REQUIRES: native && x86_64-linux -; RUN: lli --jit-linker=rtdyld --orc-lazy-debug=jit-debug-descriptor %s 2>&1 | FileCheck %s -; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-descriptor %s 2>&1 | FileCheck %s +; RUN: lli --jit-linker=rtdyld \ +; RUN: --generate=__dump_jit_debug_descriptor %s | FileCheck %s ; -; Initial entry should be empty: -; CHECK: jit_debug_descriptor 0x +; RUN: lli --jit-linker=jitlink \ +; RUN: --generate=__dump_jit_debug_descriptor %s | FileCheck %s ; -; After adding the module it must not be empty anymore: -; CHECK: jit_debug_descriptor 0x -; CHECK-NOT:000 -; CHECK-SAME: {{[048c]}} +; CHECK: Reading __jit_debug_descriptor at 0x{{.*}} +; CHECK: Version: 1 +; CHECK: Action: JIT_REGISTER_FN +; CHECK: Entry Symbol File Size Previous Entry +; CHECK: [ 0] 0x{{.*}}0x{{.*}} {{.*}} 0x + +target triple = "x86_64-unknown-unknown-elf" + +; Built-in symbol provided by the JIT +declare void @__dump_jit_debug_descriptor(ptr) + +; Host-process symbol from the GDB JIT interface +@__jit_debug_descriptor = external global i8, align 1 define i32 @main() !dbg !9 { + %1 = alloca i32, align 4 + store i32 0, ptr %1, align 4 + call void @__dump_jit_debug_descriptor(ptr @__jit_debug_descriptor), !dbg !13 ret i32 0, !dbg !14 } diff --git a/llvm/test/ExecutionEngine/OrcLazy/debug-objects-elf-minimal.ll b/llvm/test/ExecutionEngine/OrcLazy/debug-objects-elf-minimal.ll new file mode 100644 index 000..31fe730b740366a --- /dev/null +++ b/llvm/test/ExecutionEngine/OrcLazy/debug-objects-elf-minimal.ll @@ -0,0 +1,82 @@ +; REQUIRES: native && x86_64-linux + +; In-memory debug-object contains some basic DWARF +; +; RUN: lli --jit-linker=rtdyld \ +; RUN: --generate=__dump_jit_debug_objects %s | llvm-dwarfdump -- diff - | FileCheck %s +; +; RUN: lli --jit-linker=jitlink \ +; RUN: --generate=__dump_jit_debug_objects %s | llvm-dwarfdump -- diff - | FileCheck %s +; +; CHECK: -:file format elf64-x86-64 +; CHECK: .debug_info contents: +; CHECK: 0x: Compile Unit: length = 0x0047, format = DWARF32, version = 0x0004, abbr_offset = 0x, addr_size = 0x08 (next unit at 0x004b) +; CHECK: DW_TAG_compile_unit +; CHECK: DW_AT_producer ("compiler version") +; CHECK: DW_AT_language (DW_LANG_C99) +; CHECK: DW_AT_name ("source-file.c") +; CHECK: DW_AT_stmt_list () +; CHECK: DW_AT_comp_dir ("/workspace") +; CHECK: DW_AT_low_pc() +; CHECK: DW_AT_high_pc () +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_low_pc () +; CHECK: DW_AT_high_pc () +; CHECK: DW_AT_frame_base (DW_OP_reg7 RSP) +; CHECK: DW_AT_name("main") +; CHECK: DW_AT_decl_file ("/workspace/source-file.c") +; CHECK: DW_AT_decl_line (4) +; CHECK: DW_AT_type("int") +; CHECK: DW_AT_external(true) +; CHECK: DW_TAG_base_type +; CHECK: DW_AT_name("int") +; CHECK: DW_AT_encoding(DW_ATE_signed) +; CHECK: DW_AT_byte_size (0x04) +; CHECK: NULL + +; Text section of the in-memory debug-object has a non-null load-address +; +; RUN: lli --jit-linker=rtdyld \ +; RUN: --generate=__dump_jit_debug_objects %s | llvm-objdump --section-headers - | \ +; RUN: FileCh
[llvm-branch-commits] [llvm] [lld] [RISCV] Support RISC-V TLSDESC in LLD (PR #77516)
MaskRay wrote: I have found several issues. * `tlsDescRel = R_RISCV_TLSDESC_CALL;` should be `R_RISCV_TLSDESC` * LOAD_LO12_I/ADD_LO12_I/CALL relocations reference a label at the HI20 location. `val` computed by `sec.getRelocTargetVA` cannot be used as-is. * TLS optimization (https://maskray.me/blog/2021-02-14-all-about-thread-local-storage#link-time-tls-optimization) is actually mandatory for TLSDESC. Unlike ia32, we don't need `adjustTlsExpr`. Some special handling is required. #79099 reuses an old revision of the LLVM part but otherwise is a rewrite and should fix these issues as well as implement linker relaxation. https://github.com/llvm/llvm-project/pull/77516 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits