1. Oct 25, 2021
    • Matthias Braun's avatar
      X86InstrInfo: Look across basic blocks in optimizeCompareInstr · 4b75d674
      Matthias Braun authored
      This extends `optimizeCompareInstr` to continue the backwards search
      when it reached the beginning of a basic block. If there is a single
      predecessor block then we can just continue the search in that block and
      mark the EFLAGS register as live-in.
      
      Differential Revision: https://reviews.llvm.org/D110862
      4b75d674
    • Matthias Braun's avatar
      X86InstrInfo: Refactor and cleanup optimizeCompareInstr · 683994c8
      Matthias Braun authored
      This changes the first part of `optimizeCompareInstr` being split into a
      loop with a forward scan for cases that re-use zero flags from a
      producer in case of compare with zero and a backward scan for finding an
      instruction equivalent to a compare.
      
      The code now uses a single backward scan searching for the next
      instructions that reads or writes EFLAGS.
      
      Also:
      - Add comments giving examples for the 3 cases handled.
      - Check `MI` which contains the result of the zero-compare cases,
        instead of re-checking `IsCmpZero`.
      - Tweak coding style in some loops.
      - Add new MIR based tests that test the optimization in isolation.
      
      This also removes a check for flag readers in situations like this:
      ```
      = SUB32rr %0, %1, implicit-def $eflags
      ...  we no longer stop when there are $eflag users here
      CMP32rr %0, %1   ; will be removed
      ...
      ```
      
      Differential Revision: https://reviews.llvm.org/D110857
      683994c8
    • Philip Reames's avatar
      Treat branch on poison as immediate UB (under an off by default flag) · a461fa64
      Philip Reames authored
      The LangRef clearly states that branching on a undef or poison value is immediate undefined behavior, but historically, we have not been consistent about implementing that interpretation in the optimizer. Historically, we used (in some cases) a more relaxed model which essentially looked for provable UB along both paths which was control dependent on the condition. However, we've never been 100% consistent here. For instance SCEV uses the strong model for increments which form AddRecs (and only addrecs).
      
      At the moment, the last big blocker for finally making this switch is enabling the fix landed in D106041. Loop unswitching (in it's classic form) is incorrect as it creates many "branch on poisons" when unswitching conditions originally unreachable within the loop.
      
      This change adds a flag to value tracking which allows to easily test the optimization potential of treating branch on poison as immediate UB. It's intended to help ease work on getting us finally through this transition and avoid multiple independent rediscovers of the same issues.
      
      Differential Revision: https://reviews.llvm.org/D112026
      a461fa64
    • Philip Reames's avatar
      [instcombine] Fix oss-fuzz 39934 (mul matcher can match non-instruction) · 3c06ecaa
      Philip Reames authored
      Fixes a crash observed by oss-fuzz in 39934.  Issue at hand is that code expects a pattern match on m_Mul to imply the operand is a mul instruction, however mul constexprs are also valid here.
      3c06ecaa
    • Vitaly Buka's avatar
      [sanitizer] Remove tag from StackDepotNode · 85021768
      Vitaly Buka authored
      And share storage with size.
      
      Depends on D111615.
      
      Differential Revision: https://reviews.llvm.org/D111616
      85021768
    • Vitaly Buka's avatar
      [sanitizer] Remove use_count from StackDepotNode · e5859afa
      Vitaly Buka authored
      This is msan/dfsan data which does not need waste cache
      of other sanitizers.
      
      Depends on D111614.
      
      Differential Revision: https://reviews.llvm.org/D111615
      e5859afa
    • Fangrui Song's avatar
      [ARC] Fix -Wunused-variable. NFC · 54405a49
      Fangrui Song authored
      54405a49
    • Kazu Hirata's avatar
      [llvm] Call *(Set|Map)::erase directly (NFC) · 1c35973c
      Kazu Hirata authored
      We can erase an item in a set or map without checking its membership
      first.
      1c35973c
    • Kazu Hirata's avatar
      Use llvm::is_contained (NFC) · 7cc8fa2d
      Kazu Hirata authored
      7cc8fa2d
  2. Oct 24, 2021
    • Groverkss's avatar
      [MLIR] FlatAffineValueConstraints: Fix bug in mergeSymbolIds · f5f59268
      Groverkss authored
      This patch fixes a bug in implementation `mergeSymbolIds` where symbol
      identifiers were not unique after merging them. Asserts for checking uniqueness
      before and after the merge are also added. The asserts checking uniqueness
      after the merge fail without the fix on existing test cases.
      
      Reviewed By: arjunp
      
      Differential Revision: https://reviews.llvm.org/D111958
      f5f59268
    • Nikita Popov's avatar
      2ae67c96
    • Sanjay Patel's avatar
      35c767a6
    • Sanjay Patel's avatar
      d34cad31
    • Kazu Hirata's avatar
      [TableGen] Use llvm::erase_value (NFC) · b33c2118
      Kazu Hirata authored
      b33c2118
    • Kazu Hirata's avatar
      Use StringRef::contains (NFC) · 4ba9d9c8
      Kazu Hirata authored
      4ba9d9c8
    • Sylvestre Ledru's avatar
      Add support of the next Ubuntu (Ubuntu 22.04 - Jammy Jellyfish) · a709787c
      Sylvestre Ledru authored
      It is going to be a LTS release
      a709787c
    • Simon Pilgrim's avatar
      [X86] findEltLoadSrc - fix shift amount variable name. NFCI. · b09f2ee5
      Simon Pilgrim authored
      Fix the copy + paste, renaming shift amt from Idx to Amt
      b09f2ee5
    • Nikita Popov's avatar
      [InstSimplify] Simplify fetching of index size (NFC) · 0c7f85d7
      Nikita Popov authored
      Directly fetch the size instead of going through the index type
      first.
      0c7f85d7
    • Balazs Benics's avatar
      Revert "[analyzer][solver] Introduce reasoning for not equal to operator" · f9db6a44
      Balazs Benics authored
      This reverts commit cac8808f.
      
       #5 0x00007f28ec629859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
       #6 0x00007f28ec629729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
       #7 0x00007f28ec63af36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
       #8 0x00007f28ecc2cc46 llvm::APInt::compareSigned(llvm::APInt const&) const (libLLVMSupport.so.14git+0xeac46)
       #9 0x00007f28e7bbf957 (anonymous namespace)::SymbolicRangeInferrer::VisitBinaryOperator(clang::ento::RangeSet, clang::BinaryOperatorKind, clang::ento::RangeSet, clang::QualType) (libclangStaticAnalyzerCore.so.14git+0x1df957)
       #10 0x00007f28e7bbf2db (anonymous namespace)::SymbolicRangeInferrer::infer(clang::ento::SymExpr const*) (libclangStaticAnalyzerCore.so.14git+0x1df2db)
       #11 0x00007f28e7bb2b5e (anonymous namespace)::RangeConstraintManager::assumeSymNE(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::SymExpr const*, llvm::APSInt const&, llvm::APSInt const&) (libclangStaticAnalyzerCore.so.14git+0x1d2b5e)
       #12 0x00007f28e7bc67af clang::ento::RangedConstraintManager::assumeSymUnsupported(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::SymExpr const*, bool) (libclangStaticAnalyzerCore.so.14git+0x1e67af)
       #13 0x00007f28e7be3578 clang::ento::SimpleConstraintManager::assumeAux(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::NonLoc, bool) (libclangStaticAnalyzerCore.so.14git+0x203578)
       #14 0x00007f28e7be33d8 clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::NonLoc, bool) (libclangStaticAnalyzerCore.so.14git+0x2033d8)
       #15 0x00007f28e7be32fb clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::DefinedSVal, bool) (libclangStaticAnalyzerCore.so.14git+0x2032fb)
       #16 0x00007f28e7b15dbc clang::ento::ConstraintManager::assumeDual(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>, clang::ento::DefinedSVal) (libclangStaticAnalyzerCore.so.14git+0x135dbc)
       #17 0x00007f28e7b4780f clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNodeSet&, clang::Expr const*) (libclangStaticAnalyzerCore.so.14git+0x16780f)
      
      This is known to be triggered on curl, tinyxml2, tmux, twin and on xerces.
      But @bjope also reported similar crashes.
      So, I'm reverting it to make our internal bots happy again.
      
      Differential Revision: https://reviews.llvm.org/D106102
      f9db6a44
  3. Oct 23, 2021