1. Dec 10, 2018
    • Craig Topper's avatar
      [X86] If the carry input to an addcarry/subborrow intrinsic is known to be 0,... · 2b09d17d
      Craig Topper authored
      [X86] If the carry input to an addcarry/subborrow intrinsic is known to be 0, emit a flag setting ADD/SUB instead of ADC/SBB.
      
      Previously we had to take the carry in and add -1 to it to set the carry flag so we could use it with ADC/SBB. But if we know its 0 then we don't need to bother.
      
      This should go a long way towards fixing PR24545.
      
      llvm-svn: 348727
      2b09d17d
    • Kamil Rytarowski's avatar
      Add OpenBSD support to OpenMP · 7e1ea993
      Kamil Rytarowski authored
      Summary: This patch permits OpenMP to build and work (with both gcc and clang) on OpenBSD. It mostly follows what was done for FreeBSD and NetBSD, except OpenBSD does not have pthread_getattr_np support, so it follows OS X in that one instance.
      
      Reviewers: #openmp, krytarowski
      
      Reviewed By: krytarowski
      
      Subscribers: guansong, jfb, emaste, mgorny, krytarowski, #openmp
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D34280
      
      llvm-svn: 348726
      7e1ea993
    • Kamil Rytarowski's avatar
      Add DragonFlyBSD support to OpenMP · a56ac949
      Kamil Rytarowski authored
      Summary:
      Additions mostly follow FreeBSD and NetBSD and are not intrusive.
      There is similar patch for OpenBSD: https://reviews.llvm.org/D34280
      
      The -lm was being omitted due to -Wl,--as-needed in cmake rule, similar patch is in freebsd-ports/devel/llvm-devel port.
      
      Simple OpenMP programs compile and work as expected:
      $ clang-devel ~/omp_hello.c -fopenmp -I/usr/local/llvm-devel/include
      $ LD_LIBRARY_PATH=/usr/local/llvm-devel/lib OMP_NUM_THREADS=100 ./a.out
      
      The assertion in LLVMgold.so when -fopenmp was used together with -flto in 20170524 snapshot is no longer triggered on current svn-trunk and works fine as in llvm-4.0 with our local patches.
      
      Reviewers: #openmp, krytarowski
      
      Reviewed By: krytarowski
      
      Subscribers: dexonsmith, jfb, krytarowski, guansong, gregrodgers, emaste, mgorny, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D35129
      
      llvm-svn: 348725
      a56ac949
  2. Dec 09, 2018
    • Nico Weber's avatar
      Remove unneeded dependency from lib/Target/X86/Utils/ to lib/IR (aka Core). · b9616619
      Nico Weber authored
      The dependency was added in r213995 in response to r213986 which did make
      X86/Utils depend on IR, but r256680 later removed that dependency again.
      
      llvm-svn: 348724
      b9616619
    • Sanjay Patel's avatar
      [x86] regenerate test checks; NFC · 099beb25
      Sanjay Patel authored
      llvm-svn: 348723
      099beb25
    • Sanjay Patel's avatar
      [x86] don't try to convert add with undef operands to LEA · 19bc8502
      Sanjay Patel authored
      The existing code tries to handle an undef operand while transforming an add to an LEA, 
      but it's incomplete because we will crash on the i16 test with the debug output shown below. 
      It's better to just give up instead. Really, GlobalIsel should have folded these before we 
      could get into trouble.
      
      # Machine code for function add_undef_i16: NoPHIs, TracksLiveness, Legalized, RegBankSelected, Selected
      
      bb.0 (%ir-block.0):
        liveins: $edi
        %1:gr32 = COPY killed $edi
        %0:gr16 = COPY %1.sub_16bit:gr32
        %5:gr64_nosp = IMPLICIT_DEF
        %5.sub_16bit:gr64_nosp = COPY %0:gr16
        %6:gr64_nosp = IMPLICIT_DEF
        %6.sub_16bit:gr64_nosp = COPY %2:gr16
        %4:gr32 = LEA64_32r killed %5:gr64_nosp, 1, killed %6:gr64_nosp, 0, $noreg
        %3:gr16 = COPY killed %4.sub_16bit:gr32
        $ax = COPY killed %3:gr16
        RET 0, implicit killed $ax
      
      # End machine code for function add_undef_i16.
      
      *** Bad machine code: Reading virtual register without a def ***
      - function:    add_undef_i16
      - basic block: %bb.0  (0x7fe6cd83d940)
      - instruction: %6.sub_16bit:gr64_nosp = COPY %2:gr16
      - operand 1:   %2:gr16
      LLVM ERROR: Found 1 machine code errors.
      
      Differential Revision: https://reviews.llvm.org/D54710
      
      llvm-svn: 348722
      19bc8502
    • Simon Pilgrim's avatar
      [X86] Extend pfm counter coverage for llvm-exegesis · e9d8275e
      Simon Pilgrim authored
      Extension to rL348617, turns out llvm-exegesis doesn't need to match the perf counter name against a scheduler model resource name - so I've added a few more counters that I could find in the libpfm4 source code (and fix a typo in the knl/knm retired_uops counter - which uses 'all' instead of 'any').
      
      llvm-svn: 348721
      e9d8275e
    • Stephen Kelly's avatar
      NFC: Rename TemplateDecl dump utilities · 2413638a
      Stephen Kelly authored
      There is a clang::TemplateDecl AST type, so a method called
      VisitTemplateDecl looks like it should 'override' the method from the
      base visitor, but it does not because of the extra parameters it takes.
      
      In reality, these methods are utilities, so name them like utilities.
      
      llvm-svn: 348720
      2413638a
    • Stephen Kelly's avatar
      NFC: Move dump of individual comment nodes to NodeDumper · e26a88aa
      Stephen Kelly authored
      Reviewers: aaron.ballman
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55190
      
      llvm-svn: 348719
      e26a88aa
    • Stephen Kelly's avatar
      Revert "Introduce optional labels to dumpStmt" · 50a29bd4
      Stephen Kelly authored
      This reverts commit 933402caa09963792058198578522a95f013c69c.
      
      llvm-svn: 348718
      50a29bd4
    • Stephen Kelly's avatar
      Introduce optional labels to dumpStmt · 3283535d
      Stephen Kelly authored
      If the label is present, it is added as a child, with the statement a
      child of the label.  This preserves behavior of the InitListExpr dump
      output.
      
      llvm-svn: 348717
      3283535d
    • Stephen Kelly's avatar
      Inline hasNodes into only caller · 39271a19
      Stephen Kelly authored
      It is easier to refactor with fewer utility methods.
      
      llvm-svn: 348716
      39271a19
    • Stephen Kelly's avatar
      Inline dumpFullComment into callers · 570b2976
      Stephen Kelly authored
      It causes confusion over whether it or dumpComment is the more
      important. It is easier to refactor with fewer utility methods.
      
      llvm-svn: 348715
      570b2976
    • Stephen Kelly's avatar
      Re-order content from InitListExpr · 7ec37b2b
      Stephen Kelly authored
      Summary:
      This causes no change in the output of ast-dump-stmt.cpp due to the way
      child nodes are printed with a delay.
      
      Reviewers: aaron.ballman
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55398
      
      llvm-svn: 348714
      7ec37b2b
    • Stephen Kelly's avatar
      Fix InitListExpr test · 2ac0c371
      Stephen Kelly authored
      Wrong case of Check meant this has no effect.
      
      llvm-svn: 348713
      2ac0c371
    • Nikita Popov's avatar
      [X86] Add test for PR39926; NFC · 31924494
      Nikita Popov authored
      The test file shows a case where the avoid store forwarding block
      pass misses to copy a range (-1..1) when the load displacement
      changes sign.
      
      Baseline test for D55485.
      
      llvm-svn: 348712
      31924494
    • Frederic Riss's avatar
      Revert a hunk that shouldn't have been included in the last commit. · 60b88127
      Frederic Riss authored
      I've seen this line trigger UB, but that's obviously not the correct fix...
      
      llvm-svn: 348711
      60b88127
    • Frederic Riss's avatar
      Remove some UB in RegisterContextDarwin_arm64.cpp · f5debe22
      Frederic Riss authored
      llvm-svn: 348710
      f5debe22
    • Fangrui Song's avatar
      SourceManager: insert(make_pair(..)) -> try_emplace. NFC · eae2b49f
      Fangrui Song authored
      llvm-svn: 348709
      eae2b49f
    • Martin Storsjo's avatar
      [COFF] Map truncated .eh_frame section name · e3093808
      Martin Storsjo authored
      PE/COFF sections can have section names truncated to 8 chars, in order to
      have the name available at runtime. (The string table, where long untruncated
      names are stored, isn't loaded at runtime.)
      
      This allows various llvm tools to dump the .eh_frame section from such
      executables.
      
      Patch by Peiyuan Song!
      
      Differential Revision: https://reviews.llvm.org/D55407
      
      llvm-svn: 348708
      e3093808
    • David Carlier's avatar
      Fix conflict types for this FreeBSD test. · 83b07545
      David Carlier authored
      llvm-svn: 348707
      83b07545
    • Sanjay Patel's avatar
      [DAGCombiner] re-enable truncation of binops · e767bf44
      Sanjay Patel authored
      This is effectively re-committing the changes from:
      rL347917 (D54640)
      rL348195 (D55126)
      ...which were effectively reverted here:
      rL348604
      ...because the code had a bug that could induce infinite looping
      or eventual out-of-memory compilation.
      
      The bug was that this code did not guard against transforming
      opaque constants. More details are in the post-commit mailing
      list thread for r347917. A reduced test for that is included
      in the x86 bool-math.ll file. (I wasn't able to reduce a PPC
      backend test for this, but it was almost the same pattern.)
      
      Original commit message for r347917:
      
      The motivating case for this is shown in:
      https://bugs.llvm.org/show_bug.cgi?id=32023
      and the corresponding rot16.ll regression tests.
      
      Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
      sequences that don't get folded in IR.
      
      As the TODO comments suggest, there will be regressions if we extend this (for x86,
      we mostly seem to be missing LEA opportunities, but there are likely vector folds
      missing too). I think those should be considered existing bugs because this is the
      same transform that we do as an IR canonicalization in instcombine. We just need
      more tests to make those visible independent of this patch.
      
      llvm-svn: 348706
      e767bf44
  3. Dec 08, 2018