1. Aug 23, 2022
    • Philip Reames's avatar
      [TTI] Use OperandValueInfo in getArithmeticInstrCost implementation [NFC] · 104fa367
      Philip Reames authored
      This change completes the process of replacing OperandValueKind and OperandValueProperties which were previously passed independently in this API with a single container class which contains both.
      
      This is the change which motivated the whole sequence which preceeded it.  In an original spike version of this change, I'd noticed a nasty bug: I'd changed the signature without changing names, and as result, we silently passed additional information through a callsite which previously dropped the power-of-two fact.  This might be harmless in most cases, but at least a couple clearly dependend for correctness on not passing that property through.
      
      I did my best to split off prior changes which reduced the scope of this one, and which made it possible to use compiler assistance.  For instance, every parameter which changes type in this change also changes name.  This was intentional to make sure that every call site possible effected must show up in the diff.  This let me audit each one closely.
      104fa367
    • Jacques Pienaar's avatar
      [mlir][shape] refine shape.func and shape.with_shape · af29db64
      Jacques Pienaar authored
      - shape.with_shape supports ExtentTensorType
      - add helper to create shape.func
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D131977
      af29db64
    • Greg Clayton's avatar
      Modify all register values whose byte size matches the address size to be... · ae376feb
      Greg Clayton authored
      Modify all register values whose byte size matches the address size to be formatter as eFormatAddressInfo.
      
      This allows users to see similar output to what the "register read" command emits in LLDB's command line.
      
      Added a test to verify that the PC has the correct value with contains a pointer followed by the module + function name and the source line info. Something like:
      
      0x0000000100000a64 a.out`main + 132 at main.cpp:17:11
      
      Differential Revision: https://reviews.llvm.org/D129528
      ae376feb
    • Greg Clayton's avatar
      Don't create sections for SHN_ABS symbols in ELF files. · f0697d7c
      Greg Clayton authored
      Symbols that have the section index of SHN_ABS were previously creating extra top level sections that contained the value of the symbol as if the symbol's value was an address. As far as I can tell, these symbol's values are not addresses, even if they do have a size. To make matters worse, adding these extra sections can stop address lookups from succeeding if the symbol's value + size overlaps with an existing section as these sections get mapped into memory when the image is loaded by the dynamic loader. This can cause stack frames to appear empty as the address lookup fails completely.
      
      This patch:
      - doesn't create a section for any SHN_ABS symbols
      - makes symbols that are absolute have values that are not addresses
      - add accessors to SBSymbol to get the value and size of a symbol as raw integers. Prevoiusly there was no way to access a symbol's value from a SBSymbol because the only accessors were:
      
        SBAddress SBSymbol::GetStartAddress();
        SBAddress SBSymbol::GetEndAddress();
      
        and these accessors would return an invalid SBAddress if the symbol's value wasn't an address
      - Adds a test to ensure no ".absolute.<symbol-name>" sections are created
      - Adds a test to test the new SBSymbol APIs
      
      Differential Revision: https://reviews.llvm.org/D131705
      f0697d7c
    • Sanjay Patel's avatar
      2880d7b9
    • Chris Bieneman's avatar
      [NFC] Rename dx.shader to hlsl.shader · 9a478d52
      Chris Bieneman authored
      This metadata annotation is HLSL-specific not DirectX specific. It will
      need to be attached for shaders regardless of whether they are targeting
      DXIL.
      9a478d52
    • Philip Reames's avatar
      [X86][AArch64][WebAsm][RISCV] Query operand properties instead of using enums directly [nfc] · 478cf943
      Philip Reames authored
      This is part of an ongoing transition to use OperandValueInfo which combines OperandValueKind and OperandValueProperties.  This change adds some accessor methods and uses them to simplify backend code.  The primary motivation of doing so is removing uses of the parameters so that an upcoming api change is less error prone.
      478cf943
    • Philip Reames's avatar
      [X86][TTI] Rename OpNInfo to OpNKind [nfc] · 5e87a020
      Philip Reames authored
      Both are reasonable names; this is solely that an upcoming change can use the OpNInfo name, and the compiler can tell me if I forgot to update something (instead of silently passing along properties that might not hold.)
      5e87a020
    • Alan Zhao's avatar
      Revert "[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol" · 8c8cfaaf
      Alan Zhao authored
      This reverts commit 6db15a82.
      
      Reverted because this breaks offical Chrome builds targeting Android on
      arm: https://crbug.com/1354305
      
      Repro: https://drive.google.com/file/d/1pgQI2adwx3DJJqIYvMY4i249ouHU0rmu/view?usp=sharing
      8c8cfaaf
    • David Majnemer's avatar
      [clang-cl] Add _M_FP_* #defines for floating point modes · 0bf525bf
      David Majnemer authored
      This keeps clang compatible with MSVC defines for the FP environment.
      These defines are used by the CRT and other libraries to interrogate
      what to expect. Perhaps most importantly, they feed into the definition
      of float_t and double_t which may result in ODR violations between MSVC
      and clang.
      0bf525bf
    • Shoaib Meenai's avatar
      [MachO] Fix formatting. NFC · 491a5c95
      Shoaib Meenai authored
      The style guide says that all arms of an if-else should have braces if
      any arm does [1].
      
      [1] https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
      491a5c95
    • Stephen Tozer's avatar
      5fa6e8c3
    • Stephen Tozer's avatar
      [DebugInfo] Let InstrRefBasedLDV handle joins for lists of debug ops · 53fd5af6
      Stephen Tozer authored
      In preparation for adding support for DBG_VALUE_LIST instructions in
      InstrRefLDV, this patch updates the logic for joining variables at block
      joins to support joining variables that use multiple debug operands.
      This is one of the more meaty "logical" changes, although the line count
      isn't too high - this changes pickVPHILoc to find a valid joined
      location for every operand, with part of the function being split off
      into pickValuePHILoc which finds a location for a single operand.
      
      Differential Revision: https://reviews.llvm.org/D128180
      53fd5af6
    • Akira Hatanaka's avatar
    • David Penry's avatar
      [ModuloSchedule] Add interface call to accept/reject SMS schedules · ced705c4
      David Penry authored
      This interface allows a target to reject a proposed
      SMS schedule.  For Hexagon/PowerPC, all schedules
      are accepted, leaving behavior unchanged.  For ARM,
      schedules which exceed register pressure limits are
      rejected.
      
      Also, two RegisterPressureTracker methods now need to be public so
      that register pressure can be computed by more callers.
      
      Reapplication of D128941/(reversion:D132037) with small fix.
      
      Differential Revision: https://reviews.llvm.org/D132170
      ced705c4
    • Jay Foad's avatar
      [InstCombine] Change order of canonicalization of ADD and AND · f82c55fa
      Jay Foad authored
      Canonicalize ((x + C1) & C2) --> ((x & C2) + C1) for suitable constants
      C1 and C2, instead of the other way round. This should allow more
      constant ADDs to be matched as part of addressing modes for loads and
      stores.
      
      Differential Revision: https://reviews.llvm.org/D130080
      f82c55fa
    • Jay Foad's avatar
      [InstCombine] Try not to demand low order bits for Add · 2754ff88
      Jay Foad authored
      Don't demand low order bits from the LHS of an Add if:
      - they are not demanded in the result, and
      - they are known to be zero in the RHS, so they can't possibly
        overflow and affect higher bit positions
      
      This is intended to avoid a regression from a future patch to change
      the order of canonicalization of ADD and AND.
      
      Differential Revision: https://reviews.llvm.org/D130075
      2754ff88
    • Jay Foad's avatar
      [InstCombine] Add tests for D130075 · 8b24e640
      Jay Foad authored
      Differential Revision: https://reviews.llvm.org/D132381
      8b24e640
    • Vitaly Buka's avatar
      [tsan] Keep thread/stack for closed FD · d848186a
      Vitaly Buka authored
      Fixes b/242869837
      
      Reviewed By: dvyukov
      
      Differential Revision: https://reviews.llvm.org/D132068
      d848186a
    • David Majnemer's avatar
      [clang-cl] Increase /fp flag fidelity · 3d89323d
      David Majnemer authored
      They were mapped as follows:
      - /fp:except to --ftrapping-math
      - /fp:except- to --fno-trapping-math
      - /fp:strict to --fno-fast-math
      - /fp:precise to --fno-fast-math
      
      Let's map them as follows:
      - /fp:except to --ffp-exception-behavior=strict
      - /fp:except- to --ffp-exception-behavior=ignore
      - /fp:strict to --ffp-model=strict
      - /fp:precise to --ffp-model=ignore
      
      I believe the changes to /fp:except are technically a no-op but it makes
      the mapping a lot clearer. The changes for /fp:strict and /fp:precise are not
      no-ops, they now match MSVC's behavior.
      
      While we are here, also add support for /fp:contract by mapping it to
      -ffp-contract=on.
      3d89323d
    • Philip Reames's avatar
      [TTI] Use OperandValueInfo in getMemoryOpCost client api [nfc] · 27d3321c
      Philip Reames authored
      This removes the last use of OperandValueKind from the client side API, and (once this is fully plumbed through TTI implementation) allow use of the same properties in store costing as arithmetic costing.
      27d3321c
    • Kazu Hirata's avatar
      [CodeGen] Fix unused variable warnings · 71771f85
      Kazu Hirata authored
      71771f85
    • Usman Nadeem's avatar
      [Flang][Driver] Add support for PIC · ef5ede52
      Usman Nadeem authored
      This patch does the following:
      
       - Consumes the PIC flags (fPIC/fPIE/fropi/frwpi etc) in flang-new.
         tools::ParsePICArgs() in ToolChains/CommonArgs.cpp is used for this.
       - Adds FC1Option to "-mrelocation-model", "-pic-level", and "-pic-is-pie"
         command line options.
       - Adds the above options to flang/Frontend/CodeGenOptions' data structure.
       - Sets the relocation model in the target machine, and
       - Sets module flags for the respective PIC/PIE type in LLVM IR.
      
      I have tried my best to replicate how clang does things.
      
      Differential Revision: https://reviews.llvm.org/D131533
      
      Change-Id: I68fe64910be28147dc5617826641cea71b92d94d
      ef5ede52
    • Philip Reames's avatar
      [TTI] Remove OperandValueKind/Properties from getArithmeticInstrCost interface [nfc] · 274f86e7
      Philip Reames authored
      This completes the client side transition to the OperandValueInfo version of this routine.  Backend TTI implementations still use the prior versions for now.
      274f86e7
    • Nemanja Ivanovic's avatar
      [GTest] Change detection of libpthread · 8537a99b
      Nemanja Ivanovic authored
      We currently use CMake's find_library function to detect whether
      libpthread exists on the system to determine if pthread should
      be added on the link step. However, there are configurations in
      which CMake's path checking fails to find the library even though
      the toolchain has it.
      
      One such case is with Clang 14.0.0 on PowerPC. Due to a recent
      change, the build puts libc++ and related libraries in a
      subdirectory that appears to depend on the default target triple.
      CMake then uses that subdirectory to determine the architecture
      and adds that name to its search paths. However, the triple for
      the system GNU toolchain is different so CMake fails to find it.
      Namely, Clang 14.0.0's default target triple and the subdirectory
      name is powerpc64le-unknown-linux-gnu whereas the system GNU
      toolchain has powerpc64le-linux-gnu. Clang's driver has no trouble
      finding either the GNU includes/libraries or Clang's own. But
      CMake seems to get this wrong.
      
      The net result of this is that we can't do a shared libraries
      build of ToT with Clang 14.0.0.
      
      This patch proposes using HAVE_LIBPTHREAD which CMake seems to
      determine by compiling a test file with -lpthread (or perhaps
      -pthread, I can't really get CMake to tell me how it is figuring
      this out). If that variable tells CMake that the build compiler
      accepts the pthread option, it seems reasonable to depend on
      that variable to determine if we should add it to the link step
      when building the llvm_gtest library.
      8537a99b
    • Kazu Hirata's avatar
      [LiveDebugValues] Fix a warning · 36ec4dec
      Kazu Hirata authored
      This patch fixes:
      
        llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:330:5: error:
        anonymous types declared in an anonymous union are an extension
        [-Werror,-Wnested-anon-types]
      36ec4dec
    • Mike Rice's avatar
      [OpenMP][NFC] Use OMPInteropInfo in the OMPDeclareVariantAttr attribute · 129904d5
      Mike Rice authored
      In preparation for allowing the prefer_type list in the append_args clause,
      use the OMPInteropInfo in the attribute for 'declare variant'.
      
      This requires adding a new Argument kind to the attribute code. This change
      adds a specific attribute to pass an array of OMPInteropInfo. It implements
      new tablegen needed to handle the interop-type part of the structure. When
      prefer_type is added, more work will be needed to dump, instantiate, and
      serialize the PreferTypes field in OMPInteropInfo.
      
      Differential Revision: https://reviews.llvm.org/D132270
      129904d5
    • Tarun Prabhu's avatar
      [flang] Fold F08 parity intrinsic · 2f2fce8e
      Tarun Prabhu authored
      Perform compile-time folding of the F08 parity intrinsic when all parameters are compile-time constants.
      
      Differential Revision: https://reviews.llvm.org/D129785
      2f2fce8e
    • Philip Reames's avatar
      [TTI] Migrate getOperandInfo to OperandVaueInfo [nfc] · c42a5f1c
      Philip Reames authored
      This is part of merging OperandValueKind and OperandValueProperties.
      c42a5f1c
    • Arthur Eubanks's avatar
      [bazel][docs] Mention how to provide path to compiler · b04d01c0
      Arthur Eubanks authored
      And some other cleanups/clarifications.
      
      Reviewed By: saugustine
      
      Differential Revision: https://reviews.llvm.org/D132396
      b04d01c0
    • Arthur Eubanks's avatar
      [bazel] Move some CI flags into .bazelrc · d5a57ab7
      Arthur Eubanks authored
      d5a57ab7
    • Stephen Tozer's avatar
      [DebugInfo][NFC] Represent DbgValues with multiple ops in IRefLDV · b5ba5d2a
      Stephen Tozer authored
      In preparation for allowing InstrRefBasedLDV to handle DBG_VALUE_LIST,
      this patch updates the internal representation that it uses to represent
      debug values to store a list of values. This is one of the more
      significant changes in terms of line count, but is fairly simple and
      should not affect the output of this pass.
      
      Differential Revision: https://reviews.llvm.org/D128177
      b5ba5d2a
    • River Riddle's avatar
      [mlir:Bytecode] Fix asan failure · 96fd3f2d
      River Riddle authored
      We were accessing the region state after it got popped from the stack.
      96fd3f2d
    • Dmitry Preobrazhensky's avatar
    • Philip Reames's avatar
      [TTI] Start process of merging OperandValueKind and OperandValueProperties [nfc] · 5cd42710
      Philip Reames authored
      OperandValueKind and OperandValueProperties both provide facts about the operands of an instruction for purposes of cost modeling.  We've discussed merging them several times; before I plumb through more flags, let's go ahead and do so.
      
      This change only adds the client side interface for getArithmeticInstrCost and makes a couple of minor changes in client code to prove that it works.  Target TTI implementations still use the split flags.  I'm deliberately splitting what could be one big change into a series of smaller ones so that I can lean on the compiler to catch errors along the way.
      5cd42710
    • Arthur Eubanks's avatar
      9a83f384
    • Matthias Braun's avatar
      RegisterClassInfo: Fix CSR cache invalidation · b2542c40
      Matthias Braun authored
      `RegisterClassInfo` caches information like allocation orders and reuses
      it for multiple machine functions where possible. However the `MCPhysReg
      *CalleeSavedRegs` field used to test whether the set of callee saved
      registers changed did not work: After D28566
      `MachineRegisterInfo::getCalleeSavedRegs()` can return dynamically
      computed CSR sets that are only valid while the `MachineRegisterInfo`
      object of the current function exists.
      
      This changes the code to make a copy of the CSR list instead of keeping
      a possibly invalid pointer around.
      
      Differential Revision: https://reviews.llvm.org/D132080
      b2542c40
    • Nico Weber's avatar
      clang/apple: Infer simulator env from -mios-simulator-version-min= flag · 3affbae5
      Nico Weber authored
      Before this patch, open-source clang would consider
      `-target x86_64-apple-darwin -mios-simulator-version-min=11.0` as
      targeting the iOS simulator, due to the mios flag informing it
      that we want to target iOS, and logic in the driver then realizing
      that x86 iOS builds must be the simulator.
      
      However, for `-target arm64-apple-darwin -mios-simulator-version-min=11.0`
      that didn't work and clang thought that it's building for actual iOS,
      and not for the simulator.
      
      Due to this, building compiler-rt for arm64 iossim would lead to
      all .o files in RTSanitizerCommonSymbolizer.iossim.dir being built
      for iOS instead of for iOS simulator, and clang would ask ld64 to
      link for iOS, but using the iPhoneSimulator sysroot. This would then
      lead to many warnings from ld64 looking like:
      
          ld: warning: building for iOS, but linking in .tbd file
              (.../iPhoneSimulator.sdk/usr/lib/libc++abi.tbd) built for iOS Simulator
      
      Worse, with ld64.lld, this diagnostic is currently an error instead
      of a warning.
      
      This patch makes it so that the presence of -mios-simulator-version-min=
      now informs clang that we're building for simulator. That way, all the
      .o files are built for simulator, the linker is informed that we're
      building for simulator, and everything Just Works.
      
      (Xcode's clang already behaves like this, so this makes open-source clang
      match Xcode clang.)
      
      We can now likely remove the hack to treat non-mac darwin x86 as
      simulator, but doing that feels slightly risky, so I'm leaving that
      for a follow-up patch.
      
      (This patch is made necessary by the existence of arm64 macs.)
      
      Differential Revision: https://reviews.llvm.org/D132258
      3affbae5
  2. Aug 22, 2022