1. Sep 08, 2019
  2. Sep 07, 2019
    • Simon Atanasyan's avatar
    • Fangrui Song's avatar
      [ELF][MC] Set types of aliases of IFunc to STT_GNU_IFUNC · 72e99e63
      Fangrui Song authored
      ```
      .type  foo,@gnu_indirect_function
      .set   foo,foo_resolver
      
      .set foo2,foo
      .set foo3,foo2
      ```
      
      The types of foo2 and foo3 should be STT_GNU_IFUNC, but we currently
      resolve them to the type of foo_resolver. This patch fixes it.
      
      Differential Revision: https://reviews.llvm.org/D67206
      Patch by Senran Zhang
      
      llvm-svn: 371312
      72e99e63
    • Roman Lebedev's avatar
      [SimplifyCFG][NFC] Autogenerate PhiEliminate3.ll · 4e76f880
      Roman Lebedev authored
      llvm-svn: 371311
      4e76f880
    • Roman Lebedev's avatar
      [SimplifyCFG][NFC] Autogenerate two tests · 88bab08a
      Roman Lebedev authored
      llvm-svn: 371310
      88bab08a
    • Bjorn Pettersson's avatar
      [CodeGen] Handle SMULFIXSAT with scale zero in TargetLowering::expandFixedPointMul · d065c811
      Bjorn Pettersson authored
      Summary:
      Normally TargetLowering::expandFixedPointMul would handle
      SMULFIXSAT with scale zero by using an SMULO to compute the
      product and determine if saturation is needed (if overflow
      happened). But if SMULO isn't custom/legal it falls through
      and uses the same technique, using MULHS/SMUL_LOHI, as used
      for non-zero scales.
      
      Problem was that when checking for overflow (handling saturation)
      when not using MULO we did not expect to find a zero scale. So
      we ended up in an assertion when doing
        APInt::getLowBitsSet(VTSize, Scale - 1)
      
      This patch fixes the problem by adding a new special case for
      how saturation is computed when scale is zero.
      
      Reviewers: RKSimon, bevinh, leonardchan, spatel
      
      Reviewed By: RKSimon
      
      Subscribers: wuzish, nemanjai, hiraditya, MaskRay, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67071
      
      llvm-svn: 371309
      d065c811
    • Bjorn Pettersson's avatar
      [Intrinsic] Add the llvm.umul.fix.sat intrinsic · 5e331e4c
      Bjorn Pettersson authored
      Summary:
      Add an intrinsic that takes 2 unsigned integers with
      the scale of them provided as the third argument and
      performs fixed point multiplication on them. The
      result is saturated and clamped between the largest and
      smallest representable values of the first 2 operands.
      
      This is a part of implementing fixed point arithmetic
      in clang where some of the more complex operations
      will be implemented as intrinsics.
      
      Patch by: leonardchan, bjope
      
      Reviewers: RKSimon, craig.topper, bevinh, leonardchan, lebedev.ri, spatel
      
      Reviewed By: leonardchan
      
      Subscribers: ychen, wuzish, nemanjai, MaskRay, jsji, jdoerfert, Ka-Ka, hiraditya, rjmccall, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D57836
      
      llvm-svn: 371308
      5e331e4c
    • Nikita Popov's avatar
      [X86] Fix pshuflw formation from repeated shuffle mask (PR43230) · 314893cc
      Nikita Popov authored
      Fix for https://bugs.llvm.org/show_bug.cgi?id=43230.
      
      When creating PSHUFLW from a repeated shuffle mask, we have to apply
      the checks to the repeated mask, not the original one. For the test
      case from PR43230 the inspected part of the original mask is all undef.
      
      Differential Revision: https://reviews.llvm.org/D67314
      
      llvm-svn: 371307
      314893cc
    • Nikita Popov's avatar
      [LVI] Look through extractvalue of insertvalue · fdc6977f
      Nikita Popov authored
      This addresses the issue mentioned on D19867. When we simplify
      with.overflow instructions in CVP, we leave behind extractvalue
      of insertvalue sequences that LVI no longer understands. This
      means that we can not simplify any instructions based on the
      with.overflow anymore (until some over pass like InstCombine
      cleans them up).
      
      This patch extends LVI extractvalue handling by calling
      SimplifyExtractValueInst (which doesn't do anything more than
      constant folding + looking through insertvalue) and using the block
      value of the simplification.
      
      A possible alternative would be to do something similar to
      SimplifyIndVars, where we instead directly try to replace
      extractvalue users of the with.overflow. This would need some
      additional structural changes to CVP, as it's currently not legal
      to remove anything but the current instruction -- we'd have to
      introduce a worklist with instructions scheduled for deletion or similar.
      
      Differential Revision: https://reviews.llvm.org/D67035
      
      llvm-svn: 371306
      fdc6977f
    • Nikita Popov's avatar
      [X86] Add test for PR43230; NFC · 5d02f259
      Nikita Popov authored
      llvm-svn: 371305
      5d02f259
    • Bjorn Pettersson's avatar
      [DwarfExpression] Disallow some rewrites to avoid undefined behavior · 2b698a13
      Bjorn Pettersson authored
      Summary:
      The value operand in DW_OP_plus_uconst/DW_OP_constu value can be
      large (it uses uint64_t as representation internally in LLVM).
      This means that in the uint64_t to int conversions, previously done
      by DwarfExpression::addMachineRegExpression, could lose information.
      Also, the negation done in "-Offset" was undefined behavior in case
      Offset was exactly INT_MIN.
      
      To avoid the above problems, we now avoid transformation like
       [Reg, DW_OP_plus_uconst, Offset] --> [DW_OP_breg, Offset]
      and
       [Reg, DW_OP_constu, Offset, DW_OP_plus]  --> [DW_OP_breg, Offset]
      when Offset > INT_MAX.
      
      And we avoid to transform
       [Reg, DW_OP_constu, Offset, DW_OP_minus] --> [DW_OP_breg,-Offset]
      when Offset > INT_MAX+1.
      
      The patch also adjusts DwarfCompileUnit::constructVariableDIEImpl
      to make sure that "DW_OP_constu, Offset, DW_OP_minus" is used
      instead of "DW_OP_plus_uconst, Offset" when creating DIExpressions
      with negative frame index offsets.
      
      Notice that this might just be the tip of the iceberg. There
      are lots of fishy handling related to these constants. I think both
      DIExpression::appendOffset and DIExpression::extractIfOffset may
      trigger undefined behavior for certain values.
      
      Reviewers: sdesmalen, rnk, JDevlieghere
      
      Reviewed By: JDevlieghere
      
      Subscribers: jholewinski, aprantl, hiraditya, ychen, uabelho, llvm-commits
      
      Tags: #debug-info, #llvm
      
      Differential Revision: https://reviews.llvm.org/D67263
      
      llvm-svn: 371304
      2b698a13
    • Bjorn Pettersson's avatar
      [DebugInfo] Pre-commit of test case for DW_OP_breg/DW_OP_fbreg folds · e85acf94
      Bjorn Pettersson authored
      This currently triggers undefined behavior if executed with an
      ubsan build. It is just a precommit of the test case to show that
      we got a problem.
      
      Fix is proposed in https://reviews.llvm.org/D67263 and plan is to
      commit the fix directly after this patch.
      
      llvm-svn: 371303
      e85acf94
    • Simon Pilgrim's avatar
      d7d8bb93
    • Roman Lebedev's avatar
      [SimplifyCFG][NFC] Make merge-cond-stores-cost.ll X86-specific, and rewrite it · 395f254b
      Roman Lebedev authored
      We clearly perform store-merging, even though div is really costly.
      
      llvm-svn: 371300
      395f254b
    • Fangrui Song's avatar
      [ELF][test] Improve tests · 0e79890d
      Fangrui Song authored
      Add file-level comments
      Delete insignificant addresses to make them more tolerant to layout changes
      Simplify test output
      
      Delete weak-undef-val.s - covered by relocation-undefined-weak.s
      Delete weak-undef-export.s - covered by additional test added to weak-undef.s
      Delete version-undef-sym.s - covered by undefined-versioned-symbol.s => version-symbol-undef.s
      Delete symbol-ordering-file2.s - covered by symbol-ordering-file.s
      Delete gotpcrelx.s - covered by gotpc-relax-und-dso.s => x86-64-gotpc-relax-und-dso.s
      
      llvm-svn: 371299
      0e79890d
    • Benjamin Kramer's avatar
      [Attributor] Make unimplemented method pure virtual. · 84c7904d
      Benjamin Kramer authored
      Otherwise the compiler mistakes it for a vtable anchor.
      
      llvm-svn: 371298
      84c7904d
    • Roman Lebedev's avatar
      [SimplifyCFG][NFC] Show that we don't consider the cost when merging cond stores · 0ff6d7f3
      Roman Lebedev authored
      We count instruction count in each BB's separately, not their cost.
      
      llvm-svn: 371297
      0ff6d7f3
    • Roman Lebedev's avatar
      [SimplifyCFG][NFC] Regenerate merge-cond-stores* tests · 8d3e4d3a
      Roman Lebedev authored
      llvm-svn: 371296
      8d3e4d3a
    • Roman Lebedev's avatar
      [SimplifyCFG] SpeculativelyExecuteBB(): It's SpeculatedInstructions, not SpeculationCost · 45ba2659
      Roman Lebedev authored
      It counts the number of instructions we are ok speculating
      (at most 1 there), not their cost, so rename accordingly.
      
      llvm-svn: 371294
      45ba2659
    • Sylvestre Ledru's avatar
      Replicate the change "[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment" · 112f1453
      Sylvestre Ledru authored
      on AVR to avoid a breakage.
      See r371200 / https://reviews.llvm.org/D67229
      
      llvm-svn: 371293
      112f1453
    • Fangrui Song's avatar
      [ELF][test] Improve LTO tests · 89f78596
      Fangrui Song authored
      Add file-level comments
      Delete insignificant addresses to make them more tolerant to layout changes
      Simplify test output
      
      llvm-svn: 371292
      89f78596
    • Hideto Ueno's avatar
      [Attributor] ValueSimplify Abstract Attribute · f2b9dc47
      Hideto Ueno authored
      Summary:
      This patch introduces initial `AAValueSimplify` which simplifies a value in a context.
      
      example
      - (for function returned) If all the return values are the same and constant, then we can replace callsite returned with the constant.
      - If an internal function takes the same value(constant) as an argument in the callsite, then we can replace the argument with that constant.
      
      Reviewers: jdoerfert, sstefan1
      
      Reviewed By: jdoerfert
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66967
      
      llvm-svn: 371291
      f2b9dc47
    • David Zarzycki's avatar
      [git-llvm] Do not reinvent `@{upstream}` · 7faffd54
      David Zarzycki authored
      Make `git-llvm` more robust when used with a nontrivial repository.
      
      https://reviews.llvm.org/D67262
      
      llvm-svn: 371290
      7faffd54
    • Xing GUO's avatar
      Revert [CodeGen] Fix typos to run tests. NFC. · ed20dcb8
      Xing GUO authored
      This reverts r371286 (git commit b38105bb)
      
      r371286 caused build bots' failure. I'll check it.
      
      llvm-svn: 371289
      ed20dcb8
    • Xing GUO's avatar
      [CodeGen] Fix typos to run tests. NFC. · b38105bb
      Xing GUO authored
      llvm-svn: 371286
      b38105bb
    • Teresa Johnson's avatar
      Remove stale TLI Module level pass registration · ea61fcc2
      Teresa Johnson authored
      Clang patch to adapt to LLVM changes in D66428 that make the TLI
      require a Function. There is no longer a module-level
      TargetLibraryAnalysis, so remove its registration
      
      llvm-svn: 371285
      ea61fcc2
    • Teresa Johnson's avatar
      Change TargetLibraryInfo analysis passes to always require Function · 9c27b59c
      Teresa Johnson authored
      Summary:
      This is the first change to enable the TLI to be built per-function so
      that -fno-builtin* handling can be migrated to use function attributes.
      See discussion on D61634 for background. This is an enabler for fixing
      handling of these options for LTO, for example.
      
      This change should not affect behavior, as the provided function is not
      yet used to build a specifically per-function TLI, but rather enables
      that migration.
      
      Most of the changes were very mechanical, e.g. passing a Function to the
      legacy analysis pass's getTLI interface, or in Module level cases,
      adding a callback. This is similar to the way the per-function TTI
      analysis works.
      
      There was one place where we were looking for builtins but not in the
      context of a specific function. See FindCXAAtExit in
      lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
      could provide the wrong behavior in some corner cases. Suggestions
      welcome.
      
      Reviewers: chandlerc, hfinkel
      
      Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66428
      
      llvm-svn: 371284
      9c27b59c
    • Craig Topper's avatar
      [X86] Add tests for fp128 frem, sqrt, sin, and cos. · dd507867
      Craig Topper authored
      llvm-svn: 371283
      dd507867