1. Oct 08, 2018
    • Oliver Stannard's avatar
      [AArch64] Fix verifier error when outlining indirect calls · 9ecdac8e
      Oliver Stannard authored
      The MachineOutliner for AArch64 transforms indirect calls into indirect
      tail calls, replacing the call with the TCRETURNri pseudo-instruction.
      This pseudo lowers to a BR, but has the isCall and isReturn flags set.
      
      The problem is that TCRETURNri takes a tcGPR64 as the register argument,
      to prevent indiret tail-calls from using caller-saved registers. The
      indirect calls transformed by the outliner could use caller-saved
      registers. This is fine, because the outliner ensures that the register
      is available at all call sites. However, this causes a verifier failure
      when the register is not in tcGPR64. The fix is to add a new
      pseudo-instruction like TCRETURNri, but which accepts any GPR.
      
      Differential revision: https://reviews.llvm.org/D52829
      
      llvm-svn: 343959
      9ecdac8e
    • Alex Bradbury's avatar
      [RISCV] Update alu8.ll and alu16.ll test cases · 5af6c149
      Alex Bradbury authored
      The srli test in alu8.ll was a no-op, as it shifted by 8 bits. Fix this, and 
      also change the immediate in alu16.ll as shifted by something other than a 
      poewr of 8 is more interesting.
      
      llvm-svn: 343958
      5af6c149
    • Kristina Brooks's avatar
      [DebugInfo][PDB] Fix a signed/unsigned coversion warning · bcc86a95
      Kristina Brooks authored
      Fix the following warning when compiling with clang (caused by commit
      rL343951):
      
      GlobalsStream.cpp:61:33: warning: comparison of integers of different
      signs: 'int' and 'uint32_t'
      
      This also avoids double evaluation of `GlobalsTable.HashBuckets.size()`.
      
      llvm-svn: 343957
      bcc86a95
    • Ewan Crawford's avatar
      [InstCombine] Fix incongruous GEP type addrspace · fa120cbd
      Ewan Crawford authored
      Currently running the @insertelem_after_gep function below through the InstCombine pass with opt produces invalid IR.
      
      Input:
      ```
      define void @insertelem_after_gep(<16 x i32>* %t0) {
         %t1 = bitcast <16 x i32>* %t0 to [16 x i32]*
         %t2 = addrspacecast [16 x i32]* %t1 to [16 x i32] addrspace(3)*
         %t3 = getelementptr inbounds [16 x i32], [16 x i32] addrspace(3)* %t2, i64 0, i64 0
         %t4 = insertelement <16 x i32 addrspace(3)*> undef, i32 addrspace(3)* %t3, i32 0
         call void @extern_vec_pointers_func(<16 x i32 addrspace(3)*> %t4)
         ret void
      }
      ```
      
      Output:
      
      ```
      define void @insertelem_after_gep(<16 x i32>* %t0) {
        %t3 = getelementptr inbounds <16 x i32>, <16 x i32>* %t0, i64 0, i64 0
        %t4 = insertelement <16 x i32 addrspace(3)*> undef, i32 addrspace(3)* %t3, i32 0
        call void @my_extern_func(<16 x i32 addrspace(3)*> %t4)
        ret void
      }
      ```
      
      Which although causes no complaints when produced, isn't valid IR as the insertelement use of the %t3 GEP expects an address space.
      
      ```
      opt: /tmp/bad.ll:52:73: error: '%t3' defined with type 'i32*' but expected 'i32 addrspace(3)*'
        %t4 = insertelement <16 x i32 addrspace(3)*> undef, i32 addrspace(3)* %t3, i32 0
      ```
      
      I've fixed this by adding an addrspacecast after the GEP in the InstCombine pass, and including a check for this type mismatch to the verifier.
      
      Reviewers: spatel, lebedev.ri
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52294
      
      llvm-svn: 343956
      fa120cbd
    • Alex Bradbury's avatar
      [SelectionDAGBuilder][NFC] Pass LHSTy to getShiftAmountTy rather than RHSTy · f27c67af
      Alex Bradbury authored
      r126518 introduced a a type parameter to the getShiftAmountTy target hook. It 
      produces the type of the shift (RHSTy), parameterised by the type of the value 
      being shifted (LHSTy). SelectionDAGBuilder::visitShift passed RHSTy rather 
      than LHSTy and this patch corrects this. The change is a no-op because in LLVM 
      IR the LHS and RHS types for a shift must be equal anyway.
      
      llvm-svn: 343955
      f27c67af
    • Max Kazantsev's avatar
      [LV] Do not create SCEVs on broken IR in emitTransformedIndex. PR39160 · b0736965
      Max Kazantsev authored
      At the point when we perform `emitTransformedIndex`, we have a broken IR (in
      particular, we have Phis for which not every incoming value is properly set). On
      such IR, it is illegal to create SCEV expressions, because their internal
      simplification process may try to prove some predicates and break when it
      stumbles across some broken IR.
      
      The only purpose of using SCEV in this particular place is attempt to simplify
      the generated code slightly. It seems that the result isn't worth it, because
      some trivial cases (like addition of zero and multiplication by 1) can be
      handled separately if needed, but more generally InstCombine is able to achieve
      the goals we want to achieve by using SCEV.
      
      This patch fixes a functional crash described in PR39160, and as side-effect it
      also generates a bit smarter code in some simple cases. It also may cause some
      optimality loss (i.e. we will now generate `mul` by power of `2` instead of
      shift etc), but there is nothing what InstCombine could not handle later. In
      case of dire need, we can support more trivial cases just in place.
      
      Note that this patch only fixes one particular case of the general problem that
      LV misuses SCEV, attempting to create SCEVs or prove predicates on invalid IR.
      The general solution, however, seems complex enough.
      
      Differential Revision: https://reviews.llvm.org/D52881
      Reviewed By: fhahn, hsaito
      
      llvm-svn: 343954
      b0736965
    • Zachary Turner's avatar
      Fix a -Wsign-compare warning. · ba73a914
      Zachary Turner authored
      llvm-svn: 343953
      ba73a914
    • Zachary Turner's avatar
      Fix a compilation failure on non-MSVC compilers. · 9f6ac4c2
      Zachary Turner authored
      llvm-svn: 343952
      9f6ac4c2
    • Zachary Turner's avatar
      [PDB] Add the ability to lookup global symbols by name. · 94926a6d
      Zachary Turner authored
      The Globals table is a hash table keyed on symbol name, so
      it's possible to lookup symbols by name in O(1) time.  Add
      a function to the globals stream to do this, and add an option
      to llvm-pdbutil to exercise this, then use it to write some
      tests to verify correctness.
      
      llvm-svn: 343951
      94926a6d
    • Craig Topper's avatar
      Revert r343948 "[LegalizeDAG] Make one of the ReplaceNode signatures take an... · 98dd9d68
      Craig Topper authored
      Revert r343948 "[LegalizeDAG] Make one of the ReplaceNode signatures take an ArrayRef instead a pointer to an array. Add assert on size of array. NFC"
      
      The assert is failing some asan tests on the bots.
      
      llvm-svn: 343950
      98dd9d68
    • Brian Gesiak's avatar
      [coro]Pass rvalue reference for named local variable to return_value · 0b568300
      Brian Gesiak authored
      Summary:
      Addressing https://bugs.llvm.org/show_bug.cgi?id=37265.
      
      Implements [class.copy]/33 of coroutines TS.
      
      When the criteria for elision of a copy/move operation are met, but not
      for an exception-declaration, and the object to be copied is designated by an
      lvalue, or when the expression in a return or co_return statement is a
      (possibly parenthesized) id-expression that names an object with automatic
      storage duration declared in the body or parameter-declaration-clause of the
      innermost enclosing function or lambda-expression, overload resolution to select
      the constructor for the copy or the return_value overload to call is first
      performed as if the object were designated by an rvalue.
      
      Patch by Tanoy Sinha!
      
      Reviewers: modocache, GorNishanov
      
      Reviewed By: modocache, GorNishanov
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D51741
      
      llvm-svn: 343949
      0b568300
    • Craig Topper's avatar
      [LegalizeDAG] Make one of the ReplaceNode signatures take an ArrayRef instead... · c058a687
      Craig Topper authored
      [LegalizeDAG] Make one of the ReplaceNode signatures take an ArrayRef instead a pointer to an array. Add assert on size of array. NFC
      
      llvm-svn: 343948
      c058a687
    • Craig Topper's avatar
      [LegalizeDAG] Move legalization of scatter and masked store from LegalizeVectorOps to LegalizeDAG. · cd38de8b
      Craig Topper authored
      This is where we legalize gather and masked load so this is consistent.
      
      Since these ops are always on vectors I've chosen to go with LegalizeDAG since that's what we do for other vector only ops like BUILD_VECTOR, VECTOR_SHUFFLE, etc. The ScalarizeMaskedMemIntrinsic pass should take care of scalarizing these before SelectionDAG so hopefully we don't need to worry about illegally typed scalar ops being emitted in the legalizing. If we did we would need to do this in LegalizeVectorOps so we could get the second type legalization that runs between LegalizeVectorOps and LegalizeDAG.
      
      llvm-svn: 343947
      cd38de8b
    • Fangrui Song's avatar
      [clangd] Migrate to LLVM STLExtras range API · 8380c9e9
      Fangrui Song authored
      llvm-svn: 343946
      8380c9e9
    • Sanjay Patel's avatar
      [DAGCombiner] allow undef elts in vector fadd matching · ecc8af61
      Sanjay Patel authored
      llvm-svn: 343945
      ecc8af61
    • Sanjay Patel's avatar
      [x86] add vector fadd with undef elts test; NFC · f956840d
      Sanjay Patel authored
      llvm-svn: 343944
      f956840d
    • Sanjay Patel's avatar
      [x86] remove redundant tests; NFC · 6c02c6a3
      Sanjay Patel authored
      The equivalent tests were added to the file with related folds in rL343941.
      
      llvm-svn: 343943
      6c02c6a3
    • Sanjay Patel's avatar
      [DAGCombiner] allow undefs when matching vector splats for fmul folds · ef76e279
      Sanjay Patel authored
      llvm-svn: 343942
      ef76e279
    • Sanjay Patel's avatar
      [x86] add vector fmul with undef elts tests; NFC · fcb1061c
      Sanjay Patel authored
      llvm-svn: 343941
      fcb1061c
  2. Oct 07, 2018
  3. Oct 06, 2018