1. May 06, 2019
    • Hans Wennborg's avatar
      Revert r359949 "[clang] adding explicit(bool) from c++2a" · d2b9fc88
      Hans Wennborg authored
      This caused Clang to start erroring on the following:
      
        struct S {
          template <typename = int> explicit S();
        };
      
        struct T : S {};
      
        struct U : T {
          U();
        };
        U::U() {}
      
        $ clang -c /tmp/x.cc
        /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T'
        U::U() {}
           ^
        /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted
          because base class 'S' has no default constructor
        struct T : S {};
                   ^
        1 error generated.
      
      See discussion on the cfe-commits email thread.
      
      This also reverts the follow-ups r359966 and r359968.
      
      > this patch adds support for the explicit bool specifier.
      >
      > Changes:
      > - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
      > - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
      > - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
      > - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
      > - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
      > - Test for Semantic and Serialization were added.
      >
      > This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
      > Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.
      >
      > Patch by Tyker
      >
      > Differential Revision: https://reviews.llvm.org/D60934
      
      llvm-svn: 360024
      d2b9fc88
    • Guillaume Chatelet's avatar
      [NFC] Update memcpy tests · 3cfb48b8
      Guillaume Chatelet authored
      Summary: Runs utils/update_llc_test_checks.py on a few memcpy files
      
      Reviewers: courbet
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61507
      
      Remove cfi noise by adding nounwind
      
      llvm-svn: 360023
      3cfb48b8
    • Fangrui Song's avatar
      [X86] Move files to correct directories after D60552 · 041c377a
      Fangrui Song authored
      llvm-svn: 360022
      041c377a
    • Clement Courbet's avatar
      [SimplifyLibCalls] Simplify bcmp too. · 9e1f2a7f
      Clement Courbet authored
      Summary: Fixes PR40699.
      
      Reviewers: gchatelet
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61585
      
      llvm-svn: 360021
      9e1f2a7f
    • Sam McCall's avatar
      [clangd] Always call getFormatStyleForFile(). · 949d69f5
      Sam McCall authored
      This means "format" will no longer return an error if the -fallback-style flag
      is invalid, it will log and use LLVM style. This doesn't really matter.
      
      Also document the dependence on global variables. (This patch is a
      compromise - it's probably not worth actually avoiding the globals).
      
      llvm-svn: 360020
      949d69f5
    • Pengfei Wang's avatar
      [NFC] This is a test for the commit access. · b5d3430d
      Pengfei Wang authored
      Summary: Signed-off-by: Pengfei Wang <pengfei.wang@intel.com>
      
      Reviewers: LuoYuanke
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61580
      
      llvm-svn: 360019
      b5d3430d
    • Luo, Yuanke's avatar
      Enable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake · 844f6629
      Luo, Yuanke authored
      Summary:
      1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
      2. Enable intrinsics for VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
      For more details about BF16 intrinsic, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference
      
      Patch by LiuTianle
      
      Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, spatel, RKSimon
      
      Reviewed By: craig.topper
      
      Subscribers: mgorny, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D60552
      
      llvm-svn: 360018
      844f6629
    • Luo, Yuanke's avatar
      Enable AVX512_BF16 instructions, which are supported for BFLOAT16 in Cooper Lake · beec41c6
      Luo, Yuanke authored
      Summary:
      1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
      2. Enable VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS  instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
      VCVTNE2PS2BF16: Convert Two Packed Single Data to One Packed BF16 Data.
      VCVTNEPS2BF16: Convert Packed Single Data to Packed BF16 Data.
      VDPBF16PS: Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
      For more details about BF16 isa, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference
      
      Author: LiuTianle
      
      Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, RKSimon, spatel
      
      Reviewed By: craig.topper
      
      Subscribers: kristina, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60550
      
      llvm-svn: 360017
      beec41c6
    • Sam McCall's avatar
      [clangd] Support -fallback-style, similar to clang-format. · fb607580
      Sam McCall authored
      Reviewers: kadircet
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D61519
      
      llvm-svn: 360016
      fb607580
    • Fangrui Song's avatar
      DWARF v5: fix directory index in the line table · 7e55672b
      Fangrui Song authored
      Summary:
      Prior to DWARF v5, a directory index of 0 represents DW_AT_comp_dir.
      
      In DWARF v5, the index starts with 0 and Entry.DirIdx is the index into
      Prologue.IncludeDirectories.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D61253
      
      llvm-svn: 360015
      7e55672b
    • Pavel Labath's avatar
      [DWARF] Reimplement/simplify DWARFUnit::GetID · 2a0cfcce
      Pavel Labath authored
      Summary:
      The implementation of GetID used a relatively complicated algorithm,
      which returned some kind of an offset of the unit in some file
      (depending on the debug info flavour). The only thing this ID was used
      for was to enable subseqent retrieval of the unit from the SymbolFile.
      
      This can be made simpler if we just make the "ID" of the unit an index
      into the list of the units belonging to the symbol file. We already
      support indexed access to the units, so each unit already has a well
      "index" -- this just makes it accessible from within the unit.
      
      To make the distincion between "id" and "offset" clearer (and help catch
      any misuses), I also rename DWARFDebugInfo::GetCompileUnit (which
      accesses by offset) into DWARFDebugInfo::GetCompileUnitAtOffset.
      
      On its own, this only brings a minor simplification, but it enables
      further simplifications in the DIERef class (coming in a follow-up
      patch).
      
      Reviewers: JDevlieghere, clayborg, aprantl
      
      Subscribers: arphaman, jdoerfert, lldb-commits, tberghammer, jankratochvil
      
      Differential Revision: https://reviews.llvm.org/D61481
      
      llvm-svn: 360014
      2a0cfcce
    • Markus Lavin's avatar
      [DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref. · a7780741
      Markus Lavin authored
      Optimization pass lib/Transforms/IPO/GlobalOpt.cpp needs to insert
      DW_OP_deref_size instead of DW_OP_deref to be compatible with big-endian
      targets for same reasons as in D59687.
      
      Differential Revision: https://reviews.llvm.org/D60611
      
      llvm-svn: 360013
      a7780741
    • Anders Waldenborg's avatar
      [llvm-c] Make LLVMGetStringErrorTypeId a proper prototype · 4732d3ab
      Anders Waldenborg authored
      In C a function declaration with an empty argument list isn't a real
      prototype, it will allow calling the function with any number of
      arguments. It will also cause warnings when used in C code compiled with
      '-Wstrict-prototypes'
      
      Reviewed By: whitequark
      Differential Revision: https://reviews.llvm.org/D61568
      
      llvm-svn: 360012
      4732d3ab
    • Richard Smith's avatar
      P1286R2: Remove restriction that the exception specification of a · 2b45b267
      Richard Smith authored
      defaulted special member matches the implicit exception specification.
      
      llvm-svn: 360011
      2b45b267
    • Richard Smith's avatar
      Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives · 7d02ca48
      Richard Smith authored
      where either the modification or the other access is unreachable.
      
      This reverts r359984 (which reverted r359962). The bug in clang-tidy's
      test suite exposed by the original commit was fixed in r360009.
      
      llvm-svn: 360010
      7d02ca48
    • Richard Smith's avatar
      9d4bb51f
    • Craig Topper's avatar
      [SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_fatal_error. · f723490e
      Craig Topper authored
      Based on PR41748, not all cases are handled in this function.
      
      llvm_unreachable is treated as an optimization hint than can prune code paths
      in a release build. This causes weird behavior when PR41748 is encountered on a
      release build. It appears to generate an fp_round instruction from the floating
      point code.
      
      Making this a report_fatal_error prevents incorrect optimization of the code
      and will instead generate a message to file a bug report.
      
      llvm-svn: 360008
      f723490e
    • Richard Smith's avatar
      Fix up after r360006. · 96d27350
      Richard Smith authored
      llvm-svn: 360007
      96d27350
    • Richard Smith's avatar
      [c++20] Implement P1009R2: allow omitting the array bound in an array · b9fb121a
      Richard Smith authored
      new expression.
      
      This was voted into C++20 as a defect report resolution, so we
      retroactively apply it to all prior language modes (though it can never
      actually be used before C++11 mode).
      
      llvm-svn: 360006
      b9fb121a
    • Galina Kistanova's avatar
      The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit... · 9dd6537b
      Galina Kistanova authored
      The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets only (as example ARM-only) with the following error:
      
      error: unable to create target: 'No available targets are compatible with triple "< ... any 64-bit target triple ... >"'
      
      I didn't find any 64-bit dependencies for the test and I think removing '-m64' option should fix the problem and allow this test for any target specified by LLVM_DEFAULT_TARGET_TRIPLE.
      
      Patch by Vlad Vereschaka.
      
      Differential Revision: https://reviews.llvm.org/D61345
      
      llvm-svn: 360005
      9dd6537b
    • Petr Hosek's avatar
      [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them · 6971a166
      Petr Hosek authored
      When builing the hermetic static library, the compiler switch
      -fvisibility-global-new-delete-hidden is necessary to get the new and
      delete operator definitions made correctly. However, when those
      definitions are not included in the library, then this switch does harm.
      With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
      symbols makes it an error to leave them undefined or defined via dynamic
      linking that should generate PLTs for -shared linking (lld makes this a
      hard error even without -z defs). Though leaving the symbols undefined
      would usually work in practice if the linker were to allow it (and the
      user didn't pass -z defs), this actually indicates a real problem that
      could bite some target configurations more subtly at runtime. For
      example, x86-32 ELF -fpic code generation uses hidden visibility on
      declarations in the caller's scope as a signal that the call will never
      be resolved to a PLT entry and so doesn't have to meet the special ABI
      requirements for PLT calls (setting %ebx). Since these functions might
      actually be resolved to PLT entries at link time (we don't know what the
      user is linking in when the hermetic library doesn't provide all the
      symbols itself), it's not safe for the compiler to treat their
      declarations at call sites as having hidden visibility.
      
      Differential Revision: https://reviews.llvm.org/D61572
      
      llvm-svn: 360004
      6971a166
    • Petr Hosek's avatar
      [libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them · 741f52ca
      Petr Hosek authored
      When builing the hermetic static library, the compiler switch
      -fvisibility-global-new-delete-hidden is necessary to get the new and
      delete operator definitions made correctly. However, when those
      definitions are not included in the library, then this switch does harm.
      With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
      symbols makes it an error to leave them undefined or defined via dynamic
      linking that should generate PLTs for -shared linking (lld makes this a
      hard error even without -z defs). Though leaving the symbols undefined
      would usually work in practice if the linker were to allow it (and the
      user didn't pass -z defs), this actually indicates a real problem that
      could bite some target configurations more subtly at runtime. For
      example, x86-32 ELF -fpic code generation uses hidden visibility on
      declarations in the caller's scope as a signal that the call will never
      be resolved to a PLT entry and so doesn't have to meet the special ABI
      requirements for PLT calls (setting %ebx). Since these functions might
      actually be resolved to PLT entries at link time (we don't know what the
      user is linking in when the hermetic library doesn't provide all the
      symbols itself), it's not safe for the compiler to treat their
      declarations at call sites as having hidden visibility.
      
      Differential Revision: https://reviews.llvm.org/D61571
      
      llvm-svn: 360003
      741f52ca
    • Roman Lebedev's avatar
      [clang-tidy] openmp-exception-escape check: point to the structured-block · ee143107
      Roman Lebedev authored
      I'm not sure what i was thinking when i wrote it to point at the directive.
      It's at the very least confusing, and in the `for` is very misleading.
      
      We should point at the actual Stmt out of which the exception escapes,
      to highlight where it should be fixed e.g. via adding try-catch block.
      
      Yes, this breaks existing NOLINT, which is why this change needs to
      happen now, not any later.
      
      llvm-svn: 360002
      ee143107
    • Simon Pilgrim's avatar
      [X86] Pull out repeated Subtarget feature tests. NFCI. · 8462cc3c
      Simon Pilgrim authored
      Avoids a scan-build "uninitialized value" warning in X86FastISel::X86SelectFPExtOrFPTrunc
      
      llvm-svn: 360001
      8462cc3c
    • Simon Pilgrim's avatar
      [TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI. · 8c0ab999
      Simon Pilgrim authored
      Matches what we do in other getValueType functions and fixes a null dereference warning in scan-build.
      
      Also cleans up the rest of the function - use auto and standardize the variable names.
      
      llvm-svn: 360000
      8c0ab999
    • Simon Pilgrim's avatar
      [TTI][X86] Make getAddressComputationCost cost value const. NFCI. · addc90e4
      Simon Pilgrim authored
      llvm-svn: 359999
      addc90e4
    • Kristof Umann's avatar
      [analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive. · aa9d2623
      Kristof Umann authored
      https://bugs.llvm.org/show_bug.cgi?id=41741
      
      Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
      further investigation, I realized that we should regard all types
      Type::isScalarType returns true for as primitive, so I merged 
      isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
      instead.
      
      I also stumbled across yet another bug,
      https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
      this checker.
      
      Differential Revision: https://reviews.llvm.org/D61569
      
      llvm-svn: 359998
      aa9d2623
    • Roman Lebedev's avatar
      [NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb · 02569408
      Roman Lebedev authored
      Thus it does not assume that the old basic block is the basic block
      for which we are looking at successors.
      
      Not reviewed, but seems rather trivial, in line with the rest of
      previous few patches.
      
      llvm-svn: 359997
      02569408
    • Roman Lebedev's avatar
      [NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it · 1a1b9221
      Roman Lebedev authored
      Summary:
      It is a common thing to loop over every `PHINode` in some `BasicBlock`
      and change old `BasicBlock` incoming block to a new `BasicBlock` incoming block.
      `replaceSuccessorsPhiUsesWith()` already had code to do that,
      it just wasn't a function.
      So outline it into a new function, and use it.
      
      Reviewers: chandlerc, craig.topper, spatel, danielcdh
      
      Reviewed By: craig.topper
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61013
      
      llvm-svn: 359996
      1a1b9221
    • Roman Lebedev's avatar
      [NFC] PHINode: introduce replaceIncomingBlockWith() function, use it · e3b1d82b
      Roman Lebedev authored
      Summary:
      There is `PHINode::getBasicBlockIndex()`, `PHINode::setIncomingBlock()`
      and `PHINode::getNumOperands()`, but no function to replace every
      specified `BasicBlock*` predecessor with some other specified `BasicBlock*`.
      Clearly, there are a lot of places that could use that functionality.
      
      Reviewers: chandlerc, craig.topper, spatel, danielcdh
      
      Reviewed By: craig.topper
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61011
      
      llvm-svn: 359995
      e3b1d82b
    • Roman Lebedev's avatar
      [NFC] Instruction: introduce replaceSuccessorWith() function, use it · 7ad5d14f
      Roman Lebedev authored
      Summary:
      There is `Instruction::getNumSuccessors()`, `Instruction::getSuccessor()`
      and `Instruction::setSuccessor()`, but no function to replace every
      specified `BasicBlock*` successor with some other specified `BasicBlock*`.
      I've found one place where it should clearly be used.
      
      Reviewers: chandlerc, craig.topper, spatel, danielcdh
      
      Reviewed By: craig.topper
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61010
      
      llvm-svn: 359994
      7ad5d14f
    • Roman Lebedev's avatar
      [NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction · e5be660e
      Roman Lebedev authored
      Summary:
      If `deleteDeadLoop()` is called on such a loop, that has "bad" exit block,
      one that e.g. has no terminator instruction, the `DIBuilder::insertDbgValueIntrinsic()`
      will be told to insert the Dbg Value Intrinsic after `nullptr`
      (since there is no first non-PHI instruction), which will cause it to not insert
      those instructions into any basic block. The instructions will be parent-less,
      and IR verifier will complain. It is rather obvious to track down the root cause
      when that happens, so let's just assert it never happens.
      
      Reviewers: sanjoy, davide, vsk
      
      Reviewed By: vsk
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61008
      
      llvm-svn: 359993
      e5be660e
    • Jonas Devlieghere's avatar
      [test] Remove randomness · 693551d7
      Jonas Devlieghere authored
      This particular test fails once every so many runs on GreenDragon. Given
      that the randomness in the inferior isn't critical to the test, I
      removed it in the hopes that it is the cause of the flakiness.
      
      llvm-svn: 359992
      693551d7
    • Simon Pilgrim's avatar
      Move getOpcode() call into if statement. NFCI. · 5170c0e5
      Simon Pilgrim authored
      Avoids a cppcheck "Local variable name shadows outer variable" warning. 
      
      llvm-svn: 359991
      5170c0e5
    • Cameron McInally's avatar
      Precommit an FNeg InstructionSimplify test. · 1c34db85
      Cameron McInally authored
      llvm-svn: 359990
      1c34db85
    • Simon Pilgrim's avatar
      [SLPVectorizer] Prefer pre-increments. NFCI. · afb0e664
      Simon Pilgrim authored
      llvm-svn: 359989
      afb0e664
    • Craig Topper's avatar
      [LLParser] Remove unused variable after r359987. NFC · 922e252a
      Craig Topper authored
      llvm-svn: 359988
      922e252a
    • Craig Topper's avatar
      [LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set... · f6e07c47
      Craig Topper authored
      [LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on a non-integer operation.
      
      Summary: This check appears to be a leftover from when add/sub/mul could be either integer or fp. The NSW/NUW flags are only set for add/sub/mul/shl earlier. And we check that those operations only have integer types just below this. So it seems unnecessary to explicitly error for NUW/NSW being used on a add/sub/mul that have the wrong type that would later error for that.
      
      Reviewers: spatel, dblaikie, jyknight, arsenm
      
      Reviewed By: spatel
      
      Subscribers: wdng, llvm-commits, hiraditya
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61562
      
      llvm-svn: 359987
      f6e07c47
    • Craig Topper's avatar
      [LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp. · 8279695d
      Craig Topper authored
      Summary:
      These methods previously took a 0, 1, or 2 to indicate what types were allowed, but the 0 encoding which meant both fp and integer types has been unused for years. Its leftover from when add/sub/mul used to be shared between int and fp
      
      Simplify it by changing it to just a bool to distinquish int and fp.
      
      Reviewers: spatel, dblaikie, jyknight, arsenm
      
      Reviewed By: spatel
      
      Subscribers: wdng, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61561
      
      llvm-svn: 359986
      8279695d
    • Craig Topper's avatar
      [Constants] Simplify type checking switch in ConstantExpr::get. · 41c999bc
      Craig Topper authored
      Summary:
      Remove duplicate checks that both operands have the same type. This is checked
      before the switch.
      
      Use 'integer' or 'floating-point' instead of 'arithmetic' type. I think this
      might be a leftover to the days when floating point and integer operations
      shared the same opcodes.
      
      Reviewers: spatel, RKSimon, dblaikie
      
      Reviewed By: RKSimon
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61558
      
      llvm-svn: 359985
      41c999bc