1. Jul 09, 2019
    • Jeremy Morse's avatar
      Revert r364515 and r364524 · 9bebc65d
      Jeremy Morse authored
      Jordan reports on llvm-commits a performance regression with r364515,
      backing the patch out while it's investigated.
      
      llvm-svn: 365448
      9bebc65d
    • Kai Luo's avatar
      [NFC][PowerPC] Added a test to show current codegen of MachinePRE · 09329ce6
      Kai Luo authored
      llvm-svn: 365447
      09329ce6
    • Sylvestre Ledru's avatar
      Remove trailing whitespaces in the Language Extensions doc · 0adbe775
      Sylvestre Ledru authored
      llvm-svn: 365446
      0adbe775
    • Sylvestre Ledru's avatar
      Add AlignConsecutiveMacros to the clang release notes · b2a549d7
      Sylvestre Ledru authored
      llvm-svn: 365445
      b2a549d7
    • Djordje Todorovic's avatar
      Reland "[LiveDebugValues] Emit the debug entry values" · 12aca5de
      Djordje Todorovic authored
      
      
      Emit replacements for clobbered parameters location if the parameter
      has unmodified value throughout the funciton. This is basic scenario
      where we can use the debug entry values.
      
      ([12/13] Introduce the debug entry values.)
      
      Co-authored-by: default avatarAnanth Sowda <asowda@cisco.com>
      Co-authored-by: default avatarNikola Prica <nikola.prica@rt-rk.com>
      Co-authored-by: default avatarIvan Baev <ibaev@cisco.com>
      
      Differential Revision: https://reviews.llvm.org/D58042
      
      llvm-svn: 365444
      12aca5de
    • Fangrui Song's avatar
      [ELF] Assert sizeof(SymbolUnion) <= 80 · 50e7f45b
      Fangrui Song authored
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D64077
      
      llvm-svn: 365443
      50e7f45b
    • Fangrui Song's avatar
      [ELF][test] Rename tail-merge-string-align2.s to merge-string-align2.s · c117be6f
      Fangrui Song authored
      This test was added by D64200/r365139 to check we don't merge
      SHF_MERGE|SHF_STRINGS sections with different alignments (that wastes
      space and can make MergeTailAlignment::Builder out of sync).
      
      It has nothing to do with tail merge (-O2), so rename it.
      
      llvm-svn: 365442
      c117be6f
    • Serguei Katkov's avatar
      [Loop Peeling] Add support for peeling of loops with multiple exits · 77bb3a48
      Serguei Katkov authored
      This patch modifies the loop peeling transformation so that
      it does not expect that there is only one loop exit from latch.
      
      It modifies only transformation. Update of branch weights remains
      only for exit from latch.
      
      The motivation is that in follow-up patch I plan to enable loop peeling for
      loops with multiple exits but only if other exits then from latch one goes to
      block with call to deopt.
      
      For now this patch is NFC.
      
      Reviewers: reames, mkuper, iajbar, fhahn	
      Reviewed By: reames, fhahn
      Subscribers: zzheng, llvm-commits
      Differential Revision: https://reviews.llvm.org/D63921
      
      llvm-svn: 365441
      77bb3a48
    • Yevgeny Rouban's avatar
      Prepare for making SwitchInstProfUpdateWrapper strict · 592f44a7
      Yevgeny Rouban authored
      This patch removes the test part that relates to the non-strict
      behavior of SwitchInstProfUpdateWrapper and changes
      the assertion to llvm_unreachable() to allow the check in
      release builds.
      This patch prepares SwitchInstProfUpdateWrapper to become
      strict with one line change. That is need to revert it easily
      if any failure will arise.
      
      llvm-svn: 365439
      592f44a7
    • Yonghong Song's avatar
      [BPF] Preserve debuginfo array/union/struct type/access index · 048493f8
      Yonghong Song authored
      For background of BPF CO-RE project, please refer to
        http://vger.kernel.org/bpfconf2019.html
      
      
      In summary, BPF CO-RE intends to compile bpf programs
      adjustable on struct/union layout change so the same
      program can run on multiple kernels with adjustment
      before loading based on native kernel structures.
      
      In order to do this, we need keep track of GEP(getelementptr)
      instruction base and result debuginfo types, so we
      can adjust on the host based on kernel BTF info.
      Capturing such information as an IR optimization is hard
      as various optimization may have tweaked GEP and also
      union is replaced by structure it is impossible to track
      fieldindex for union member accesses.
      
      Three intrinsic functions, preserve_{array,union,struct}_access_index,
      are introducted.
        addr = preserve_array_access_index(base, index, dimension)
        addr = preserve_union_access_index(base, di_index)
        addr = preserve_struct_access_index(base, gep_index, di_index)
      here,
        base: the base pointer for the array/union/struct access.
        index: the last access index for array, the same for IR/DebugInfo layout.
        dimension: the array dimension.
        gep_index: the access index based on IR layout.
        di_index: the access index based on user/debuginfo types.
      
      If using these intrinsics blindly, i.e., transforming all GEPs
      to these intrinsics and later on reducing them to GEPs, we have
      seen up to 7% more instructions generated. To avoid such an overhead,
      a clang builtin is proposed:
        base = __builtin_preserve_access_index(base)
      such that user wraps to-be-relocated GEPs in this builtin
      and preserve_*_access_index intrinsics only apply to
      those GEPs. Such a buyin will prevent performance degradation
      if people do not use CO-RE, even for programs which use
      bpf_probe_read().
      
      For example, for the following example,
        $ cat test.c
        struct sk_buff {
           int i;
           int b1:1;
           int b2:2;
           union {
             struct {
               int o1;
               int o2;
             } o;
             struct {
               char flags;
               char dev_id;
             } dev;
             int netid;
           } u[10];
        };
      
        static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr)
            = (void *) 4;
      
        #define _(x) (__builtin_preserve_access_index(x))
      
        int bpf_prog(struct sk_buff *ctx) {
          char dev_id;
          bpf_probe_read(&dev_id, sizeof(char), _(&ctx->u[5].dev.dev_id));
          return dev_id;
        }
        $ clang -target bpf -O2 -g -emit-llvm -S -mllvm -print-before-all \
          test.c >& log
      
      The generated IR looks like below:
        ...
        define dso_local i32 @bpf_prog(%struct.sk_buff*) #0 !dbg !15 {
          %2 = alloca %struct.sk_buff*, align 8
          %3 = alloca i8, align 1
          store %struct.sk_buff* %0, %struct.sk_buff** %2, align 8, !tbaa !45
          call void @llvm.dbg.declare(metadata %struct.sk_buff** %2, metadata !43, metadata !DIExpression()), !dbg !49
          call void @llvm.lifetime.start.p0i8(i64 1, i8* %3) #4, !dbg !50
          call void @llvm.dbg.declare(metadata i8* %3, metadata !44, metadata !DIExpression()), !dbg !51
          %4 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** @bpf_probe_read, align 8, !dbg !52, !tbaa !45
          %5 = load %struct.sk_buff*, %struct.sk_buff** %2, align 8, !dbg !53, !tbaa !45
          %6 = call [10 x %union.anon]* @llvm.preserve.struct.access.index.p0a10s_union.anons.p0s_struct.sk_buffs(
               %struct.sk_buff* %5, i32 2, i32 3), !dbg !53, !llvm.preserve.access.index !19
          %7 = call %union.anon* @llvm.preserve.array.access.index.p0s_union.anons.p0a10s_union.anons(
               [10 x %union.anon]* %6, i32 1, i32 5), !dbg !53
          %8 = call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons(
               %union.anon* %7, i32 1), !dbg !53, !llvm.preserve.access.index !26
          %9 = bitcast %union.anon* %8 to %struct.anon.0*, !dbg !53
          %10 = call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.anon.0s(
               %struct.anon.0* %9, i32 1, i32 1), !dbg !53, !llvm.preserve.access.index !34
          %11 = call i32 %4(i8* %3, i32 1, i8* %10), !dbg !52
          %12 = load i8, i8* %3, align 1, !dbg !54, !tbaa !55
          %13 = sext i8 %12 to i32, !dbg !54
          call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4, !dbg !56
          ret i32 %13, !dbg !57
        }
      
        !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "sk_buff", file: !3, line: 1, size: 704, elements: !20)
        !26 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !19, file: !3, line: 5, size: 64, elements: !27)
        !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !26, file: !3, line: 10, size: 16, elements: !35)
      
      Note that @llvm.preserve.{struct,union}.access.index calls have metadata llvm.preserve.access.index
      attached to instructions to provide struct/union debuginfo type information.
      
      For &ctx->u[5].dev.dev_id,
        . The "%6 = ..." represents struct member "u" with index 2 for IR layout and index 3 for DI layout.
        . The "%7 = ..." represents array subscript "5".
        . The "%8 = ..." represents union member "dev" with index 1 for DI layout.
        . The "%10 = ..." represents struct member "dev_id" with index 1 for both IR and DI layout.
      
      Basically, traversing the use-def chain recursively for the 3rd argument of bpf_probe_read() and
      examining all preserve_*_access_index calls, the debuginfo struct/union/array access index
      can be achieved.
      
      The intrinsics also contain enough information to regenerate codes for IR layout.
      For array and structure intrinsics, the proper GEP can be constructed.
      For union intrinsics, replacing all uses of "addr" with "base" should be enough.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      
      Differential Revision: https://reviews.llvm.org/D61809
      
      llvm-svn: 365438
      048493f8
    • Serguei Katkov's avatar
      [LoopInfo] Update getExitEdges to accept vector of pairs for non const BasicBlock · c6caddb7
      Serguei Katkov authored
      D63921 requires getExitEdges fills a vector of Edge pairs where
      BasicBlocks are not constant.
      
      The rest Loop API mostly returns non-const BasicBlocks, so to be more consistent with
      other Loop API getExitEdges is modified to return non-const BasicBlocks as well.
      
      This is an alternative solution to D64060. 
      
      Reviewers: reames, fhahn
      Reviewed By: reames, fhahn
      Subscribers: hiraditya, llvm-commits
      Differential Revision: https://reviews.llvm.org/D64309
      
      llvm-svn: 365437
      c6caddb7
    • Yonghong Song's avatar
      Revert "[BPF] Preserve debuginfo array/union/struct type/access index" · e085b40e
      Yonghong Song authored
      This reverts commit r365435.
      
      Forgot adding the Differential Revision link. Will add to the
      commit message and resubmit.
      
      llvm-svn: 365436
      e085b40e
    • Yonghong Song's avatar
      [BPF] Preserve debuginfo array/union/struct type/access index · f21eeafc
      Yonghong Song authored
      For background of BPF CO-RE project, please refer to
        http://vger.kernel.org/bpfconf2019.html
      
      
      In summary, BPF CO-RE intends to compile bpf programs
      adjustable on struct/union layout change so the same
      program can run on multiple kernels with adjustment
      before loading based on native kernel structures.
      
      In order to do this, we need keep track of GEP(getelementptr)
      instruction base and result debuginfo types, so we
      can adjust on the host based on kernel BTF info.
      Capturing such information as an IR optimization is hard
      as various optimization may have tweaked GEP and also
      union is replaced by structure it is impossible to track
      fieldindex for union member accesses.
      
      Three intrinsic functions, preserve_{array,union,struct}_access_index,
      are introducted.
        addr = preserve_array_access_index(base, index, dimension)
        addr = preserve_union_access_index(base, di_index)
        addr = preserve_struct_access_index(base, gep_index, di_index)
      here,
        base: the base pointer for the array/union/struct access.
        index: the last access index for array, the same for IR/DebugInfo layout.
        dimension: the array dimension.
        gep_index: the access index based on IR layout.
        di_index: the access index based on user/debuginfo types.
      
      If using these intrinsics blindly, i.e., transforming all GEPs
      to these intrinsics and later on reducing them to GEPs, we have
      seen up to 7% more instructions generated. To avoid such an overhead,
      a clang builtin is proposed:
        base = __builtin_preserve_access_index(base)
      such that user wraps to-be-relocated GEPs in this builtin
      and preserve_*_access_index intrinsics only apply to
      those GEPs. Such a buyin will prevent performance degradation
      if people do not use CO-RE, even for programs which use
      bpf_probe_read().
      
      For example, for the following example,
        $ cat test.c
        struct sk_buff {
           int i;
           int b1:1;
           int b2:2;
           union {
             struct {
               int o1;
               int o2;
             } o;
             struct {
               char flags;
               char dev_id;
             } dev;
             int netid;
           } u[10];
        };
      
        static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr)
            = (void *) 4;
      
        #define _(x) (__builtin_preserve_access_index(x))
      
        int bpf_prog(struct sk_buff *ctx) {
          char dev_id;
          bpf_probe_read(&dev_id, sizeof(char), _(&ctx->u[5].dev.dev_id));
          return dev_id;
        }
        $ clang -target bpf -O2 -g -emit-llvm -S -mllvm -print-before-all \
          test.c >& log
      
      The generated IR looks like below:
        ...
        define dso_local i32 @bpf_prog(%struct.sk_buff*) #0 !dbg !15 {
          %2 = alloca %struct.sk_buff*, align 8
          %3 = alloca i8, align 1
          store %struct.sk_buff* %0, %struct.sk_buff** %2, align 8, !tbaa !45
          call void @llvm.dbg.declare(metadata %struct.sk_buff** %2, metadata !43, metadata !DIExpression()), !dbg !49
          call void @llvm.lifetime.start.p0i8(i64 1, i8* %3) #4, !dbg !50
          call void @llvm.dbg.declare(metadata i8* %3, metadata !44, metadata !DIExpression()), !dbg !51
          %4 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** @bpf_probe_read, align 8, !dbg !52, !tbaa !45
          %5 = load %struct.sk_buff*, %struct.sk_buff** %2, align 8, !dbg !53, !tbaa !45
          %6 = call [10 x %union.anon]* @llvm.preserve.struct.access.index.p0a10s_union.anons.p0s_struct.sk_buffs(
               %struct.sk_buff* %5, i32 2, i32 3), !dbg !53, !llvm.preserve.access.index !19
          %7 = call %union.anon* @llvm.preserve.array.access.index.p0s_union.anons.p0a10s_union.anons(
               [10 x %union.anon]* %6, i32 1, i32 5), !dbg !53
          %8 = call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons(
               %union.anon* %7, i32 1), !dbg !53, !llvm.preserve.access.index !26
          %9 = bitcast %union.anon* %8 to %struct.anon.0*, !dbg !53
          %10 = call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.anon.0s(
               %struct.anon.0* %9, i32 1, i32 1), !dbg !53, !llvm.preserve.access.index !34
          %11 = call i32 %4(i8* %3, i32 1, i8* %10), !dbg !52
          %12 = load i8, i8* %3, align 1, !dbg !54, !tbaa !55
          %13 = sext i8 %12 to i32, !dbg !54
          call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4, !dbg !56
          ret i32 %13, !dbg !57
        }
      
        !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "sk_buff", file: !3, line: 1, size: 704, elements: !20)
        !26 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !19, file: !3, line: 5, size: 64, elements: !27)
        !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !26, file: !3, line: 10, size: 16, elements: !35)
      
      Note that @llvm.preserve.{struct,union}.access.index calls have metadata llvm.preserve.access.index
      attached to instructions to provide struct/union debuginfo type information.
      
      For &ctx->u[5].dev.dev_id,
        . The "%6 = ..." represents struct member "u" with index 2 for IR layout and index 3 for DI layout.
        . The "%7 = ..." represents array subscript "5".
        . The "%8 = ..." represents union member "dev" with index 1 for DI layout.
        . The "%10 = ..." represents struct member "dev_id" with index 1 for both IR and DI layout.
      
      Basically, traversing the use-def chain recursively for the 3rd argument of bpf_probe_read() and
      examining all preserve_*_access_index calls, the debuginfo struct/union/array access index
      can be achieved.
      
      The intrinsics also contain enough information to regenerate codes for IR layout.
      For array and structure intrinsics, the proper GEP can be constructed.
      For union intrinsics, replacing all uses of "addr" with "base" should be enough.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      llvm-svn: 365435
      f21eeafc
    • Denis Bakhvalov's avatar
      [LLD] NFC: Fixed GCC warning in ELF/Arch/RISCV.cpp · 92fb5f2e
      Denis Bakhvalov authored
      GCC emits warning on this line:
      error: enumeral and non-enumeral type in conditional
      expression [-Werror=extra]
      
      Change-Id: I04969cc32e27e310968b88ebaa4e1c4894528d74
      llvm-svn: 365434
      92fb5f2e
    • Kai Luo's avatar
      [NFC][PowerPC] Fixed unused variable 'NewInstr'. · 619e39bc
      Kai Luo authored
      llvm-svn: 365433
      619e39bc
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Added td definitions for HW regs · c776dc0b
      Stanislav Mekhanoshin authored
      Infrastructure work for future commit. NFC.
      
      Differential Revision: https://reviews.llvm.org/D64370
      
      llvm-svn: 365432
      c776dc0b
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Always use s_memtime for readcyclecounter · 818d748a
      Stanislav Mekhanoshin authored
      Differential Revision: https://reviews.llvm.org/D64369
      
      llvm-svn: 365431
      818d748a
    • Kai Luo's avatar
      [PowerPC][Peephole] Combine extsw and sldi after instruction selection · 1931ed73
      Kai Luo authored
      Summary:
      `extsw` and `sldi` are supposed to be combined if they are in the same
      BB in instruction selection phase. This patch handles the case where
      extsw and sldi are not in the same BB.
      
      Differential Revision: https://reviews.llvm.org/D63806
      
      llvm-svn: 365430
      1931ed73
    • Chen Zheng's avatar
      [PowerPC][NFC] remove redundant function isVFReg(). · 25ab27e6
      Chen Zheng authored
      llvm-svn: 365429
      25ab27e6
    • Jinsong Ji's avatar
      [MachinePipeliner] Fix Phi refers to Phi in same stage in 1st epilogue · cbd64f76
      Jinsong Ji authored
      Summary:
      This is exposed by functional testing on PowerPC.
      In some pipelined loops, Phi refer to phi did not get value defined by
      the Phi, hence getting wrong value later.
      
      As the comment mentioned, we should "use the value defined by the Phi,
      unless we're generating the firstepilog and the Phi refers to a Phi
       in a different stage.", so Phi refering to same stage Phi should use
      the value defined by the Phi here.
      
      Reviewers: bcahoon, hfinkel
      
      Reviewed By: hfinkel
      
      Subscribers: MaskRay, wuzish, nemanjai, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D64035
      
      llvm-svn: 365428
      cbd64f76
    • Jinsong Ji's avatar
      [PowerPC][MachinePipeliner][NFC] Add a testcase for Phi bug. · 18301fa8
      Jinsong Ji authored
      llvm-svn: 365427
      18301fa8
    • Heejin Ahn's avatar
      [WebAssembly] Make sret parameter work with AddMissingPrototypes · 947bfe73
      Heejin Ahn authored
      Summary:
      Even with functions with `no-prototype` attribute, there can be an
      argument `sret` (structure return) attribute, which is an optimization
      when a function return type is a struct. Fixes PR42420.
      
      Reviewers: sbc100
      
      Subscribers: dschuff, jgravelle-google, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D64318
      
      llvm-svn: 365426
      947bfe73
    • Philip Reames's avatar
      0e344e9d
    • Matthew G McGovern's avatar
      [sanitizers][windows] FIX: Rtl-Heap Interception and tests · 4e636156
      Matthew G McGovern authored
         - Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap
         - Adds unit tests for the new interceptors and expands HeapAlloc
           tests to demonstrate new functionality.
         Reviewed as D62927
         - adds fixes for ~win and x64 tests
      
      > llvm-svn: 365381
      
      llvm-svn: 365424
      4e636156
    • Yonghong Song's avatar
      [BPF] add new intrinsics preserve_{array,union,struct}_access_index · e3919c6b
      Yonghong Song authored
      For background of BPF CO-RE project, please refer to
        http://vger.kernel.org/bpfconf2019.html
      
      
      In summary, BPF CO-RE intends to compile bpf programs
      adjustable on struct/union layout change so the same
      program can run on multiple kernels with adjustment
      before loading based on native kernel structures.
      
      In order to do this, we need keep track of GEP(getelementptr)
      instruction base and result debuginfo types, so we
      can adjust on the host based on kernel BTF info.
      Capturing such information as an IR optimization is hard
      as various optimization may have tweaked GEP and also
      union is replaced by structure it is impossible to track
      fieldindex for union member accesses.
      
      Three intrinsic functions, preserve_{array,union,struct}_access_index,
      are introducted.
        addr = preserve_array_access_index(base, index, dimension)
        addr = preserve_union_access_index(base, di_index)
        addr = preserve_struct_access_index(base, gep_index, di_index)
      here,
        base: the base pointer for the array/union/struct access.
        index: the last access index for array, the same for IR/DebugInfo layout.
        dimension: the array dimension.
        gep_index: the access index based on IR layout.
        di_index: the access index based on user/debuginfo types.
      
      For example, for the following example,
        $ cat test.c
        struct sk_buff {
           int i;
           int b1:1;
           int b2:2;
           union {
             struct {
               int o1;
               int o2;
             } o;
             struct {
               char flags;
               char dev_id;
             } dev;
             int netid;
           } u[10];
        };
      
        static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr)
            = (void *) 4;
      
        #define _(x) (__builtin_preserve_access_index(x))
      
        int bpf_prog(struct sk_buff *ctx) {
          char dev_id;
          bpf_probe_read(&dev_id, sizeof(char), _(&ctx->u[5].dev.dev_id));
          return dev_id;
        }
        $ clang -target bpf -O2 -g -emit-llvm -S -mllvm -print-before-all \
          test.c >& log
      
      The generated IR looks like below:
      
        ...
        define dso_local i32 @bpf_prog(%struct.sk_buff*) #0 !dbg !15 {
          %2 = alloca %struct.sk_buff*, align 8
          %3 = alloca i8, align 1
          store %struct.sk_buff* %0, %struct.sk_buff** %2, align 8, !tbaa !45
          call void @llvm.dbg.declare(metadata %struct.sk_buff** %2, metadata !43, metadata !DIExpression()), !dbg !49
          call void @llvm.lifetime.start.p0i8(i64 1, i8* %3) #4, !dbg !50
          call void @llvm.dbg.declare(metadata i8* %3, metadata !44, metadata !DIExpression()), !dbg !51
          %4 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** @bpf_probe_read, align 8, !dbg !52, !tbaa !45
          %5 = load %struct.sk_buff*, %struct.sk_buff** %2, align 8, !dbg !53, !tbaa !45
          %6 = call [10 x %union.anon]* @llvm.preserve.struct.access.index.p0a10s_union.anons.p0s_struct.sk_buffs(
               %struct.sk_buff* %5, i32 2, i32 3), !dbg !53, !llvm.preserve.access.index !19
          %7 = call %union.anon* @llvm.preserve.array.access.index.p0s_union.anons.p0a10s_union.anons(
               [10 x %union.anon]* %6, i32 1, i32 5), !dbg !53
          %8 = call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons(
               %union.anon* %7, i32 1), !dbg !53, !llvm.preserve.access.index !26
          %9 = bitcast %union.anon* %8 to %struct.anon.0*, !dbg !53
          %10 = call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.anon.0s(
               %struct.anon.0* %9, i32 1, i32 1), !dbg !53, !llvm.preserve.access.index !34
          %11 = call i32 %4(i8* %3, i32 1, i8* %10), !dbg !52
          %12 = load i8, i8* %3, align 1, !dbg !54, !tbaa !55
          %13 = sext i8 %12 to i32, !dbg !54
          call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4, !dbg !56
          ret i32 %13, !dbg !57
        }
      
        !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "sk_buff", file: !3, line: 1, size: 704, elements: !20)
        !26 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !19, file: !3, line: 5, size: 64, elements: !27)
        !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !26, file: !3, line: 10, size: 16, elements: !35)
      
      Note that @llvm.preserve.{struct,union}.access.index calls have metadata llvm.preserve.access.index
      attached to instructions to provide struct/union debuginfo type information.
      
      For &ctx->u[5].dev.dev_id,
        . The "%6 = ..." represents struct member "u" with index 2 for IR layout and index 3 for DI layout.
        . The "%7 = ..." represents array subscript "5".
        . The "%8 = ..." represents union member "dev" with index 1 for DI layout.
        . The "%10 = ..." represents struct member "dev_id" with index 1 for both IR and DI layout.
      
      Basically, traversing the use-def chain recursively for the 3rd argument of bpf_probe_read() and
      examining all preserve_*_access_index calls, the debuginfo struct/union/array access index
      can be achieved.
      
      The intrinsics also contain enough information to regenerate codes for IR layout.
      For array and structure intrinsics, the proper GEP can be constructed.
      For union intrinsics, replacing all uses of "addr" with "base" should be enough.
      
      The test case ThinLTO/X86/lazyload_metadata.ll is adjusted to reflect the
      new addition of the metadata.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      
      Differential Revision: https://reviews.llvm.org/D61810
      
      llvm-svn: 365423
      e3919c6b
    • Matthew G McGovern's avatar
      [sanitizers][windows] Rtl-Heap Interception and tests · 848a19e4
      Matthew G McGovern authored
         - Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap
         - Adds unit tests for the new interceptors and expands HeapAlloc
           tests to demonstrate new functionality.
         Reviewed as D62927
      
      llvm-svn: 365422
      848a19e4
    • Jonas Devlieghere's avatar
      Fix ASCII art header · 53d5f3a0
      Jonas Devlieghere authored
      llvm-svn: 365421
      53d5f3a0
    • Jonas Devlieghere's avatar
      [Windows] Include ErrorHandling.h · 4936cbc9
      Jonas Devlieghere authored
      Include ErrorHandling.h for mapWindowsError.
      
      llvm-svn: 365420
      4936cbc9
    • Philip Reames's avatar
      [LoopPred] Extend LFTR normalization to the inverse EQ case · 5a637cbd
      Philip Reames authored
      A while back, I added support for NE latches formed by LFTR.  I didn't think that quite through, as LFTR will also produce the inverse EQ form for some loops and I hadn't handled that.  This change just adds handling for that case as well.
      
      llvm-svn: 365419
      5a637cbd
    • Heejin Ahn's avatar
      [WebAssembly] Fix a typo in a test file name · 8f9a4b2a
      Heejin Ahn authored
      Reviewers: sbc100
      
      Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D64324
      
      llvm-svn: 365418
      8f9a4b2a
    • Nilanjana Basu's avatar
      Changing CodeView debug info type record representation in assembly files to... · faed8516
      Nilanjana Basu authored
      Changing CodeView debug info type record representation in assembly files to make it more human-readable & editable & fixing bug introduced in r364987
      
      llvm-svn: 365417
      faed8516
    • Davide Italiano's avatar
      [crashlog] Fix a mismatch between bytes and strings. · 68946d10
      Davide Italiano authored
      The functions in read_plist() want bytes as input, not
      strings.
      
      <rdar://problem/52600712>
      
      llvm-svn: 365416
      68946d10
    • Julian Lettner's avatar
      [TSan] Fix linker error for Linux/AArch64 · c6fe02b6
      Julian Lettner authored
      llvm-svn: 365415
      c6fe02b6
    • Nico Weber's avatar
      Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source · 9d2538d2
      Nico Weber authored
      This is a better fix for the problem fixed in r334972.
      
      Also remove the rm'ing of the symlink destination that was there to
      clean up the bots -- it's over a year later, bots should be happy now.
      
      Differential Revision: https://reviews.llvm.org/D64301
      
      llvm-svn: 365414
      9d2538d2
    • Nico Weber's avatar
      Let unaliased Args track which Alias they were created from, and use that in... · e3f06b47
      Nico Weber authored
      Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
      
      With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
      value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
      'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
      flags produce much less confusing output as well.
      
      Fixes PR29106.
      
      Since an arg and its alias can have different arg types (joined vs not)
      and different values (because of AliasArgs<>), I chose to give the Alias
      its own Arg object. For convenience, I just store the alias directly in
      the unaliased arg – there aren't many arg objects at runtime, so that
      seems ok.
      
      Finally, I changed Arg::getAsString() to use the alias's representation
      if it's present – that function was already documented as being the
      suitable function for diagnostics, and most callers already used it for
      diagnostics.
      
      Implementation-wise, Arg::accept() previously used to parse things as
      the unaliased option. The core of that switch is now extracted into a
      new function acceptInternal() which parses as the _aliased_ option, and
      the previously-intermingled unaliasing is now done as an explicit step
      afterwards.
      
      (This also changes one place in lld that didn't use getAsString() for
      diagnostics, so that that one place now also prints the flag as the user
      wrote it, not as it looks after it went through unaliasing.)
      
      Differential Revision: https://reviews.llvm.org/D64253
      
      llvm-svn: 365413
      e3f06b47
    • Fangrui Song's avatar
      [X86][PPC] Support -mlong-double-64 · 11cb39c5
      Fangrui Song authored
      -mlong-double-64 is supported on some ports of gcc (i386, x86_64, and ppc{32,64}).
      On many other targets, there will be an error:
      
          error: unrecognized command line option '-mlong-double-64'
      
      This patch makes the driver option -mlong-double-64 available for x86
      and ppc. The CC1 option -mlong-double-64 is available on all targets for
      users to test on unsupported targets.
      
      LongDoubleSize is added as a VALUE_LANGOPT so that the option can be
      shared with -mlong-double-128 when we support it in clang.
      
      Also, make powerpc*-linux-musl default to use 64-bit long double. It is
      currently the only supported ABI on musl and is also how people
      configure powerpc*-linux-musl-gcc.
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D64067
      
      llvm-svn: 365412
      11cb39c5
    • Nico Weber's avatar
      clang-cl: Port cl.exe's C4659 to clang-cl · 98016216
      Nico Weber authored
      Differential Revision: https://reviews.llvm.org/D64349
      
      llvm-svn: 365411
      98016216
    • Artem Dergachev's avatar
      [analyzer] exploded-graph-rewriter: Implement a topology-only mode. · c6b5c5b9
      Artem Dergachev authored
      In this mode the rewriter will only rewrite program points
      and omit program states. Useful for understanding
      the rough topology of the graph.
      
      Differential Revision: https://reviews.llvm.org/D64264
      
      llvm-svn: 365410
      c6b5c5b9
    • Artem Dergachev's avatar
      [analyzer] exploded-graph-rewriter: Implement a single-path mode. · 78566e45
      Artem Dergachev authored
      Instead of rewriting the whole graph, rewrite the leftmost path in the
      graph. Useful for trimmed graphs that are still too large to display due
      to multiple equivalent reports mixed into them.
      
      Differential Revision: https://reviews.llvm.org/D64263
      
      llvm-svn: 365409
      78566e45
    • Erik Pilkington's avatar
      [ObjC] Add a -Wtautological-compare warning for BOOL · fa591c37
      Erik Pilkington authored
      On macOS, BOOL is a typedef for signed char, but it should never hold a value
      that isn't 1 or 0. Any code that expects a different value in their BOOL should
      be fixed.
      
      rdar://51954400
      
      Differential revision: https://reviews.llvm.org/D63856
      
      llvm-svn: 365408
      fa591c37