Skip to content
  1. Jul 30, 2018
    • Roman Lebedev's avatar
      [NFC] Rename test/ubsan/TestCases/{ImplicitCast => ImplicitConversion} · f07c5a0e
      Roman Lebedev authored
      Just to be consistent with the rest.
      I should have done that in the commit itself, but the filepaths
      is one thing i forgot to verify :S
      
      llvm-svn: 338307
      f07c5a0e
    • Roman Lebedev's avatar
      [docs] UndefinedBehaviorSanitizer.rst: {,un}signed-integer-overflow: tune docs · 3a5d356b
      Roman Lebedev authored
      Yes, i erroneously assumed that the "after" was meant,
      but i was wrong:
      > I really meant "performed before", for cases like 4u / -2,
      > where -2 is implicitly converted to UINT_MAX - 2 before
      > the computation. Conversions that are performed after
      > a computation aren't part of the computation at all,
      > so I think it's much clearer that they're not in scope
      > for this sanitizer.
      
      llvm-svn: 338306
      3a5d356b
    • Lang Hames's avatar
      [ORC] Add SerializationTraits for std::set and std::map. · 7361996f
      Lang Hames authored
      Also, make SerializationTraits for pairs forward the actual pair
      template type arguments to the underlying serializer. This allows, for example,
      std::pair<StringRef, bool> to be passed as an argument to an RPC call expecting
      a std::pair<std::string, bool>, since there is an underlying serializer from
      StringRef to std::string that can be used.
      
      llvm-svn: 338305
      7361996f
    • Craig Topper's avatar
      [TargetLowering] In BuildSDIV, add the MULHS/SMUL_LOHI to the Created vector. · 42d312bb
      Craig Topper authored
      BuildUDIV was already correct.
      
      llvm-svn: 338304
      42d312bb
    • Craig Topper's avatar
    • Stephen Kelly's avatar
      Avoid returning an invalid end source loc · f50288c2
      Stephen Kelly authored
      llvm-svn: 338301
      f50288c2
    • David Bolvansky's avatar
      [InstCombine] Fold Select with binary op · 6737b3a6
      David Bolvansky authored
      Summary:
      Fold
        %A = icmp eq i8 %x, 0
        %B = xor i8 %x, %z
        %C = select i1 %A, i8 %B, i8 %y
      To
        %C = select i1 %A, i8 %z, i8 %y
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=38345
      Proof: https://rise4fun.com/Alive/43J
      
      Reviewers: lebedev.ri, spatel
      
      Reviewed By: spatel
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D49954
      
      llvm-svn: 338300
      6737b3a6
    • Scott Linder's avatar
      [DebugInfo][OpenCL] Generate correct block literal debug info for OpenCL · 2b5cf041
      Scott Linder authored
      OpenCL block literal structs have different fields which are now correctly
      identified in the debug info.
      
      Differential Revision: https://reviews.llvm.org/D49930
      
      llvm-svn: 338299
      2b5cf041
    • Craig Topper's avatar
      Revert r338222 "[DAGCombiner] Remove unnecessary calls to AddToWorklist." · b94d5f85
      Craig Topper authored
      Thinking about it more it might be possible for the later nodes to be folded in getNode in such a way that the other created nodes are left dead. This can cause use counts to be incorrect on nodes that aren't dead.
      
      So its probably safer to leave this alone.
      
      llvm-svn: 338298
      b94d5f85
    • Vlad Tsyrklevich's avatar
      Revert "[GVNHoist] Re-enable GVNHoist by default" · 1c7160e8
      Vlad Tsyrklevich authored
      This reverts commit r338240 because it was causing OOMs on the UBSan
      buildbot when building clang/lib/Sema/SemaChecking.cpp
      
      llvm-svn: 338297
      1c7160e8
    • Roman Lebedev's avatar
      [compiler-rt] integer-truncation-blacklist.c: XFAIL on android/ios · 0c234517
      Roman Lebedev authored
      The Builder sanitizer-x86_64-linux-android is failing
      starting with rL338287 / D48959.
      
      It runs the tests via android_compile.py, so i'm not sure this
      is actually *this* issue:
        https://code.google.com/p/address-sanitizer/issues/detail?id=316
      but this seems oddly similar to the other XFAIL'ed cases...
      
      Right now that seems to be the only failing builder,
      so i *think* it makes sense to try to just blacklist it for now.
      
      llvm-svn: 338296
      0c234517
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Fix new task creation · f729df82
      Gheorghe-Teodor Bercea authored
      Summary:
      When OMPT is not supported the __kmp_omp_task() function is passed the parameters in the wrong order. This is a fix related to patch D47709.
      
      
      Reviewers: Hahnfeld, sconvent, caomhin, jlpeyton
      
      Reviewed By: Hahnfeld
      
      Subscribers: guansong, openmp-commits
      
      Differential Revision: https://reviews.llvm.org/D50001
      
      llvm-svn: 338295
      f729df82
    • Mandeep Singh Grang's avatar
      [OpenEmbedded] Fix lib paths for OpenEmbedded targets · e9ddc44a
      Mandeep Singh Grang authored
      Summary:
      The lib paths are not correctly picked up for OpenEmbedded sysroots (like arm-oe-linux-gnueabi) for 2 reasons:
      
      1. OpenEmbedded sysroots are of the form <sysroot>/usr/lib/<triple>/x.y.z. This form is handled in clang but only for Freescale vendor.
      
      2. 64-bit OpenEmbedded sysroots may not have a /usr/lib dir. So they cannot find /usr/lib64 as it is referenced as /usr/lib/../lib64 in clang.
      
      This is a follow-up to the llvm patch: D48861
      
      Reviewers: dlj, rengolin, fedor.sergeev, javed.absar, hfinkel, rsmith
      
      Reviewed By: rsmith
      
      Subscribers: rsmith, kristof.beyls, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D48862
      
      llvm-svn: 338294
      e9ddc44a
    • Fangrui Song's avatar
      Remove trailing space · f78650a8
      Fangrui Song authored
      sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}
      
      llvm-svn: 338293
      f78650a8
    • Manoj Gupta's avatar
      [Inline] Copy "null-pointer-is-valid" attribute in caller. · 9d83ce90
      Manoj Gupta authored
      Summary:
      Normally, inling does not happen if caller does not have
      "null-pointer-is-valid"="true" attibute but callee has it.
      
      However, alwaysinline may force callee to be inlined.
      In this case, if the caller has the "null-pointer-is-valid"="true"
      attribute, copy the attribute to caller.
      
      Reviewers: efriedma, a.elovikov, lebedev.ri, jyknight
      
      Reviewed By: efriedma
      
      Subscribers: eraman, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D50000
      
      llvm-svn: 338292
      9d83ce90
    • Fangrui Song's avatar
      Remove trailing space · 6907ce2f
      Fangrui Song authored
      sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}
      
      llvm-svn: 338291
      6907ce2f
    • David Greene's avatar
      Make test/Driver/baremetal.cpp work with linkers other than lld · ce9b3e08
      David Greene authored
      This test fails if clang is configure with, for example, gold as the
      default linker. It does not appear that this test really relies on lld
      so make the checks accept ld, ld.gold and ld.bfd too.
      
      llvm-svn: 338290
      ce9b3e08
    • Roman Lebedev's avatar
      [clang][ubsan] Implicit Conversion Sanitizer - integer truncation - clang part · b69ba227
      Roman Lebedev authored
      Summary:
      C and C++ are interesting languages. They are statically typed, but weakly.
      The implicit conversions are allowed. This is nice, allows to write code
      while balancing between getting drowned in everything being convertible,
      and nothing being convertible. As usual, this comes with a price:
      
      ```
      unsigned char store = 0;
      
      bool consume(unsigned int val);
      
      void test(unsigned long val) {
        if (consume(val)) {
          // the 'val' is `unsigned long`, but `consume()` takes `unsigned int`.
          // If their bit widths are different on this platform, the implicit
          // truncation happens. And if that `unsigned long` had a value bigger
          // than UINT_MAX, then you may or may not have a bug.
      
          // Similarly, integer addition happens on `int`s, so `store` will
          // be promoted to an `int`, the sum calculated (0+768=768),
          // and the result demoted to `unsigned char`, and stored to `store`.
          // In this case, the `store` will still be 0. Again, not always intended.
          store = store + 768; // before addition, 'store' was promoted to int.
        }
      
        // But yes, sometimes this is intentional.
        // You can either make the conversion explicit
        (void)consume((unsigned int)val);
        // or mask the value so no bits will be *implicitly* lost.
        (void)consume((~((unsigned int)0)) & val);
      }
      ```
      
      Yes, there is a `-Wconversion`` diagnostic group, but first, it is kinda
      noisy, since it warns on everything (unlike sanitizers, warning on an
      actual issues), and second, there are cases where it does **not** warn.
      So a Sanitizer is needed. I don't have any motivational numbers, but i know
      i had this kind of problem 10-20 times, and it was never easy to track down.
      
      The logic to detect whether an truncation has happened is pretty simple
      if you think about it - https://godbolt.org/g/NEzXbb - basically, just
      extend (using the new, not original!, signedness) the 'truncated' value
      back to it's original width, and equality-compare it with the original value.
      
      The most non-trivial thing here is the logic to detect whether this
      `ImplicitCastExpr` AST node is **actually** an implicit conversion, //or//
      part of an explicit cast. Because the explicit casts are modeled as an outer
      `ExplicitCastExpr` with some `ImplicitCastExpr`'s as **direct** children.
      https://godbolt.org/g/eE1GkJ
      
      Nowadays, we can just use the new `part_of_explicit_cast` flag, which is set
      on all the implicitly-added `ImplicitCastExpr`'s of an `ExplicitCastExpr`.
      So if that flag is **not** set, then it is an actual implicit conversion.
      
      As you may have noted, this isn't just named `-fsanitize=implicit-integer-truncation`.
      There are potentially some more implicit conversions to be warned about.
      Namely, implicit conversions that result in sign change; implicit conversion
      between different floating point types, or between fp and an integer,
      when again, that conversion is lossy.
      
      One thing i know isn't handled is bitfields.
      
      This is a clang part.
      The compiler-rt part is D48959.
      
      Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=37552 | PR37552 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=35409 | PR35409 ]].
      Partially fixes [[ https://bugs.llvm.org/show_bug.cgi?id=9821 | PR9821 ]].
      Fixes https://github.com/google/sanitizers/issues/940. (other than sign-changing implicit conversions)
      
      Reviewers: rjmccall, rsmith, samsonov, pcc, vsk, eugenis, efriedma, kcc, erichkeane
      
      Reviewed By: rsmith, vsk, erichkeane
      
      Subscribers: erichkeane, klimek, #sanitizers, aaron.ballman, RKSimon, dtzWill, filcab, danielaustin, ygribov, dvyukov, milianw, mclow.lists, cfe-commits, regehr
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D48958
      
      llvm-svn: 338288
      b69ba227
    • Roman Lebedev's avatar
      [compiler-rt][ubsan] Implicit Conversion Sanitizer - integer truncation - compiler-rt part · eb4a9bc3
      Roman Lebedev authored
      Summary:
      This is a compiler-rt part.
      The clang part is D48958.
      
      See [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], https://github.com/google/sanitizers/issues/940.
      
      Reviewers: #sanitizers, samsonov, vsk, rsmith, pcc, eugenis, kcc, filcab
      
      Reviewed By: #sanitizers, vsk, filcab
      
      Subscribers: llvm-commits, eugenis, filcab, kubamracek, dberris, #sanitizers, regehr
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D48959
      
      llvm-svn: 338287
      eb4a9bc3
    • George Karpenkov's avatar
      [analyzer] Store ValueDecl in DeclRegion · 676b3f01
      George Karpenkov authored
      All use cases of DeclRegion actually have ValueDecl there,
      and getting the name from declaration comes in very handy.
      
      Differential Revision: https://reviews.llvm.org/D49998
      
      llvm-svn: 338286
      676b3f01
    • David Bolvansky's avatar
      [InstSimplify] [NFC] Tests for Select with AND/OR fold · 76e95865
      David Bolvansky authored
      llvm-svn: 338285
      76e95865
    • Azharuddin Mohammed's avatar
      [cmake] [ARM] Exclude any VFP builtins if VFP is not supported · ec6bdf8d
      Azharuddin Mohammed authored
      Summary:
      rL325492 disables FPU features when using soft floating point
      (-mfloat-abi=soft), which is used internally when building for arm. This causes
      errors with builtins that utililize VFP instructions.
      
      With this change we check if VFP is enabled (by checking if the preprocessor
      macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.
      
      Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith
      
      Reviewed By: peter.smith
      
      Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D47217
      
      llvm-svn: 338284
      ec6bdf8d
    • Jonas Hahnfeld's avatar
      [CMake] Disable -Wstringop-overflow · f985f981
      Jonas Hahnfeld authored
      GCC 8 produces false-positives with this:
      In file included from <openmp>/src/runtime/src/kmp_os.h:950,
                       from <openmp>/src/runtime/src/kmp.h:78,
                       from <openmp>/src/runtime/src/kmp_environment.cpp:54:
      <openmp>/src/runtime/src/kmp_environment.cpp: In function ‘char* __kmp_env_get(const char*)’:
      <openmp>/src/runtime/src/kmp_safe_c_api.h:52:50: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
       #define KMP_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
                                                 ~~~~~~~^~~~~~~~~~~~~~~
      <openmp>/src/runtime/src/kmp_environment.cpp:97:5: note: in expansion of macro ‘KMP_STRNCPY_S’
           KMP_STRNCPY_S(result, len, value, len);
           ^~~~~~~~~~~~~
      <openmp>/src/runtime/src/kmp_environment.cpp:92:28: note: length computed here
           size_t len = KMP_STRLEN(value) + 1;
      
      This is stupid because result is allocated with KMP_INTERNAL_MALLOC(len),
      so the arguments are correct.
      
      Differential Revision: https://reviews.llvm.org/D49904
      
      llvm-svn: 338283
      f985f981
    • Richard Smith's avatar
      Delete some unreachable AST printing code. · 91c89c5e
      Richard Smith authored
      llvm-svn: 338282
      91c89c5e
    • Jonathan Peyton's avatar
      [OpenMP] Add GOMP version symbols for OMP_4.5 API · 284fab19
      Jonathan Peyton authored
      This patch adds the appropriate version symbols to the relevant API functions
      
      Differential Revision: https://reviews.llvm.org/D49859
      
      llvm-svn: 338281
      284fab19
    • Jonathan Peyton's avatar
      [OpenMP] Implement GOMP doacross compatibility · 369d72db
      Jonathan Peyton authored
      This change introduces GOMP doacross compatibility. There are 12 new interface
      functions 6 for long type and 6 for unsigned long long type:
      GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_doacross_[schedule]_start
      where schedule can be static, dynamic, guided, or runtime.
      
      These functions just translate the parameters if necessary and send them
      to the corresponding kmp function.
      E.g., GOMP_doacross_post() -> __kmpc_doacross_post()
      
      For the GOMP_doacross_post function, there is template specialization to
      account for when long is a four byte vs an eight byte type. If it is a
      four byte type, then a temporary array has to be created to convert the
      four byte integers into eight byte integers and then sending that into
      __kmpc_doacross_post(). Because GOMP_doacross_wait uses varargs, it
      always needs a temporary array and does not need template specialization.
      
      Differential Revision: https://reviews.llvm.org/D49857
      
      llvm-svn: 338280
      369d72db
    • Momchil Velikov's avatar
      [ARM, AArch64]: Use unadjusted alignment when passing composites as arguments · 20208cc0
      Momchil Velikov authored
      The "Procedure Call Procedure Call Standard for the ARM® Architecture"
      (https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf), specifies that
      composite types are passed according to their "natural alignment", i.e. the
      alignment before alignment adjustment on the entire composite is applied.
      
      The same applies for AArch64 ABI.
      
      Clang, however, used the adjusted alignment.
      
      GCC already implements the ABI correctly. With this patch Clang becomes
      compatible with GCC and passes such arguments in accordance with AAPCS.
      
      Differential Revision: https://reviews.llvm.org/D46013
      
      llvm-svn: 338279
      20208cc0
    • Jessica Paquette's avatar
      [MachineOutliner][AArch64] Add support for saving LR to a register · fa3bee47
      Jessica Paquette authored
      This teaches the outliner to save LR to a register rather than the stack when
      possible. This allows us to avoid bumping the stack in outlined functions in
      some cases. By doing this, in a later patch, we can teach the outliner to do
      something like this:
      
      f1:
        ...
        bl OUTLINED_FUNCTION
        ...
      
      f2:
        ...
        move LR's contents to a register
        bl OUTLINED_FUNCTION
        move the register's contents back
      
      instead of falling back to saving LR in both cases.
      
      llvm-svn: 338278
      fa3bee47
    • Jonathan Peyton's avatar
      [OpenMP] Fix build errors when building with KMP_DEBUG_ADAPTIVE_LOCKS=1 · 8692e142
      Jonathan Peyton authored
      This change fixes build errors when building a runtime with adaptive lock stats
      enabled. Most of the errors were due to the recent changes in the runtime, but
      it seems that we have not tried to build this debug runtime on Windows for a
      long time.
      
      Patch by Hansang Bae
      
      Differential Revision: https://reviews.llvm.org/D49823
      
      llvm-svn: 338277
      8692e142
    • Jonathan Peyton's avatar
      [OpenMP][Stats] Cleanup stats gathering code · f0682ac4
      Jonathan Peyton authored
      1) Remove unnecessary data from list node structure
      2) Remove timerPair in favor of pushing/popping explicitTimers.
         This way, nested timers will work properly.
      3) Fix #pragma omp critical timers
      4) Add histogram capability
      5) Add KMP_STATS_FILE formatting capability
      6) Have time partitioned into serial & parallel by introducing
         partitionedTimers::exchange(). This also counts the number of serial regions
         in the executable.
      7) Fix up the timers around OMP loops so that scheduling overhead and work are
         both counted correctly.
      8) Fix up the iterations statistics so they count the number of iterations the
         thread receives at each loop scheduling event
      9) Change timers so there is only one RDTSC read per event change
      10) Fix up the outdated comments for the timers
      
      Differential Revision: https://reviews.llvm.org/D49699
      
      llvm-svn: 338276
      f0682ac4
    • Fangrui Song's avatar
      [docs] Update ld.lld.1 · 05779bfc
      Fangrui Song authored
      llvm-svn: 338275
      05779bfc
    • Craig Topper's avatar
      [X86] Fix typo in comment. NFC · f014ec9b
      Craig Topper authored
      llvm-svn: 338274
      f014ec9b
    • Craig Topper's avatar
      Recommit r338204 "[X86] Correct the immediate cost for 'add/sub i64 %x, 0x80000000'." · dd0ef801
      Craig Topper authored
      This checks in a more direct way without triggering a UBSAN error.
      
      llvm-svn: 338273
      dd0ef801
    • Jessica Paquette's avatar
      Add machine verifier to arm64-opt-remarks-lazy-bfi · bbcc8895
      Jessica Paquette authored
      Previously, I thought this was a Windows failure. Then I realized it failed on
      every bot that used the verifier. This makes it use the verifier always, and
      adds that pass to the pipeline checks so that it's consistent across all bots.
      
      llvm-svn: 338272
      bbcc8895
    • David Bolvansky's avatar
      [AArch64] Support execute-only LOAD segments. · a932cd40
      David Bolvansky authored
      Summary:
      This adds an LLD flag to mark executable LOAD segments execute-only for AArch64 targets. 
      
      In AArch64 the expectation is that code is execute-only compatible, so this just adds a linker option to enforce this.
      
      Patch by: ivanlozano (Ivan Lozano)
      
      Reviewers: srhines, echristo, peter.smith, eugenis, javed.absar, espindola, ruiu
      
      Reviewed By: ruiu
      
      Subscribers: dokyungs, emaste, arichardson, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D49456
      
      llvm-svn: 338271
      a932cd40
    • David Bolvansky's avatar
      [DAGCombiner] Bug 31275- Extract a shift from a constant mul or udiv if a rotate can be formed · 2fa7fb14
      David Bolvansky authored
      Summary:
      Attempt to extract a shrl from a udiv or a shl from a mul if this allows a rotate to be formed.  This targets cases where the input to a rotate pattern was a mul or udiv by a constant and InstCombine merged one of the shifts with the op.
      
      Patch by: sameconrad (Sam Conrad)
      
      Reviewers: RKSimon, craig.topper, spatel, lebedev.ri, javed.absar
      
      Reviewed By: lebedev.ri
      
      Subscribers: efriedma, kparzysz, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D47681
      
      llvm-svn: 338270
      2fa7fb14
    • Thomas Preud'homme's avatar
      Reapply "Fix crash on inline asm with 64bit matching input in 32bit GPR" · 196149c9
      Thomas Preud'homme authored
      This reapplies commit r338206 reverted by r338214 since the bug that
      r338206 uncovered has been fixed in r338268.
      
      Add support for inline assembly with matching input operand that do not
      naturally go in the register class it is constrained to (eg. double in a
      32-bit GPR). Note that regular input is already handled by existing
      code.
      
      llvm-svn: 338269
      196149c9
    • Thomas Preud'homme's avatar
      Fix uninitialized read in ARM's PrintAsmOperand · 6c1b0752
      Thomas Preud'homme authored
      Summary:
      Fix read of uninitialized RC variable in ARM's PrintAsmOperand when
      hasRegClassConstraint returns false. This was causing
      inline-asm-operand-implicit-cast test to fail in r338206.
      
      Reviewers: t.p.northover, weimingz, javed.absar, chill
      
      Reviewed By: chill
      
      Subscribers: chill, eraman, kristof.beyls, chrib, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D49984
      
      llvm-svn: 338268
      6c1b0752
    • Jessica Paquette's avatar
      Attempt to fix Windows test failure caused by r338133 · 7816531f
      Jessica Paquette authored
      It seems like the pass pipeline on Windows is slightly different than on Linux
      and macOS. As a result, the arm64-opt-remarks-lazy-bfi test has been failing.
      
      This switches a CHECK-NEXT to a CHECK-DAG to try and get this running properly
      again.
      
      It'd be nice to switch it back to a CHECK-NEXT if possible, but the CHECK-NEXT
      lines following the line we care about (the optimization remark emitter)
      do a pretty good job of enforcing the ordering we want.
      
      Hopefully this works, since I don't have a Windows machine. ;)
      
      Example failure: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/11295
      
      llvm-svn: 338267
      7816531f
    • Evandro Menezes's avatar
      [SLC] Refactor the simplication of pow() (NFC) · a7d48286
      Evandro Menezes authored
      Use more meaningful variable names.  Mostly NFC.
      
      llvm-svn: 338266
      a7d48286
Loading