1. Jun 16, 2022
  2. Jun 15, 2022
    • Luo, Yuanke's avatar
      [CodeGen] Fix the bug of machine sink · 16547f9f
      Luo, Yuanke authored
      The use operand may be undefined. In that case we can just continue to
      check the next operand since it won't increase register pressure.
      
      Differential Revision: https://reviews.llvm.org/D127848
      16547f9f
    • Balazs Benics's avatar
      [analyzer] Relax constraints on const qualified regions · 929e60b6
      Balazs Benics authored
      The arithmetic restriction seems to be artificial.
      The comment below seems to be stale.
      Thus, we remove both.
      
      Depends on D127306.
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D127763
      929e60b6
    • Balazs Benics's avatar
      [analyzer] Treat system globals as mutable if they are not const · f4fc3f6b
      Balazs Benics authored
      Previously, system globals were treated as immutable regions, unless it
      was the `errno` which is known to be frequently modified.
      
      D124244 wants to add a check for stores to immutable regions.
      It would basically turn all stores to system globals into an error even
      though we have no reason to believe that those mutable sys globals
      should be treated as if they were immutable. And this leads to
      false-positives if we apply D124244.
      
      In this patch, I'm proposing to treat mutable sys globals actually
      mutable, hence allocate them into the `GlobalSystemSpaceRegion`, UNLESS
      they were declared as `const` (and a primitive arithmetic type), in
      which case, we should use `GlobalImmutableSpaceRegion`.
      
      In any other cases, I'm using the `GlobalInternalSpaceRegion`, which is
      no different than the previous behavior.
      
      ---
      
      In the tests I added, only the last `expected-warning` was different, compared to the baseline.
      Which is this:
      ```lang=C++
      void test_my_mutable_system_global_constraint() {
        assert(my_mutable_system_global > 2);
        clang_analyzer_eval(my_mutable_system_global > 2); // expected-warning {{TRUE}}
        invalidate_globals();
        clang_analyzer_eval(my_mutable_system_global > 2); // expected-warning {{UNKNOWN}} It was previously TRUE.
      }
      void test_my_mutable_system_global_assign(int x) {
        my_mutable_system_global = x;
        clang_analyzer_eval(my_mutable_system_global == x); // expected-warning {{TRUE}}
        invalidate_globals();
        clang_analyzer_eval(my_mutable_system_global == x); // expected-warning {{UNKNOWN}} It was previously TRUE.
      }
      ```
      
      ---
      
      Unfortunately, the taint checker will be also affected.
      The `stdin` global variable is a pointer, which is assumed to be a taint
      source, and the rest of the taint propagation rules will propagate from
      it.
      However, since mutable variables are no longer treated immutable, they
      also get invalidated, when an opaque function call happens, such as the
      first `scanf(stdin, ...)`. This would effectively remove taint from the
      pointer, consequently disable all the rest of the taint propagations
      down the line from the `stdin` variable.
      
      All that said, I decided to look through `DerivedSymbol`s as well, to
      acquire the memregion in that case as well. This should preserve the
      previously existing taint reports.
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D127306
      f4fc3f6b
    • Phoebe Wang's avatar
      Reland "Reland "[X86][RFC] Enable `_Float16` type support on X86 following the psABI"" · e1c5afa4
      Phoebe Wang authored
      Fixed the missing SQRT promotion. Adding several missing operations too.
      e1c5afa4
    • Balazs Benics's avatar
      [analyzer][NFC] Prefer using isa<> instead getAs<> in conditions · 96ccb690
      Balazs Benics authored
      Depends on D125709
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D127742
      96ccb690
    • Balazs Benics's avatar
      [analyzer][NFC] Remove dead field of UnixAPICheckers · 481f8603
      Balazs Benics authored
      Initially, I thought there is some fundamental bug here by not using the
      bool fields, but it turns out D55425 split this checker into two
      separate ones; making these fields dead.
      
      Depends on D127836, which uncovered this issue.
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D127838
      481f8603
    • Balazs Benics's avatar
      [analyzer] Fix StreamErrorState hash bug · 6c4f9998
      Balazs Benics authored
      The `Profile` function was incorrectly implemented.
      The `StreamErrorState` has an implicit `bool` conversion operator, which
      will result in a different hash than faithfully hashing the raw value of
      the enum.
      
      I don't have a test for it, since it seems difficult to find one.
      Even if we would have one, any change in the hashing algorithm would
      have a chance of breaking it, so I don't think it would justify the
      effort.
      
      Depends on D127836, which uncovered this issue by marking the related
      `Profile` function dead.
      
      Reviewed By: martong, balazske
      
      Differential Revision: https://reviews.llvm.org/D127839
      6c4f9998
    • Balazs Benics's avatar
      [analyzer][NFC] Remove dead code and modernize surroundings · f1b18a79
      Balazs Benics authored
      Thanks @kazu for helping me clean these parts in D127799.
      
      I'm leaving the dump methods, along with the unused visitor handlers and
      the forwarding methods.
      
      The dead parts actually helped to uncover two bugs, to which I'm going
      to post separate patches.
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D127836
      f1b18a79
    • Valentin Clement's avatar
      [flang][NFC] Fix some formatting · 575c9d6d
      Valentin Clement authored
      Fix some mismatch in format used in the file and reduce the diff with fir-dev
      to be able to finish the upstreaming on this file.
      
      This patch is part of the upstreaming effort from fir-dev branch.
      
      Reviewed By: PeteSteinfeld, kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D127849
      575c9d6d
    • Matthias Springer's avatar
      [mlir][tablegen] Generate default attr values in Python bindings · 989d2b51
      Matthias Springer authored
      When specifying an op attribute with a default value (via DefaultValuedAttr), the default value is a string of C++ code. In the general case, the default value of such an attribute cannot be translated to Python when generating the bindings. However, we can hard-code default Python values for frequently-used C++ default values.
      
      This change adds a Python default value for empty ArrayAttrs.
      
      Differential Revision: https://reviews.llvm.org/D127750
      989d2b51
    • Sunho Kim's avatar
      [JITLink][ELF] Log enum name of unsupported relocation type. · 9fc0aa45
      Sunho Kim authored
      Logs enum name of unsupported relocation type. This also changes elf/x86 to use common util function (getELFRelocationTypeName) inside llvm object module.
      
      Reviewed By: lhames
      
      Differential Revision: https://reviews.llvm.org/D127715
      9fc0aa45
    • Shao-Ce SUN's avatar
      [Driver][test] Make RISCV tests robust with PATH= · e180cc5f
      Shao-Ce SUN authored
      When `riscv64-unknown-linux-gnu-ld` is in the PATH, `clang -### -fuse-ld=ld --target=riscv64-unknown-linux-gnu` will use unknown-linux-gnu-ld first, which causes the error in the lit test.
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D127589
      e180cc5f