SuccessChanges

Summary

  1. [LLDB] Skip test_launch_simple from TestTargetAPI.py when remote (details)
  2. [InstSimplify] avoid crashing by trying to rem-by-zero (details)
  3. Add missing override to Makefile (details)
  4. [NFC] Rename BBSectionsPrepare -> BasicBlockSections. (details)
  5. BPF: add a SimplifyCFG IR pass during generic Scalar/IPO optimization (details)
  6. [X86] Make getX86TargetCPU return std::string instead of const char *. Remove call to MakeArgString. NFCI (details)
  7. [X86] Optimize out a few extra strlen calls in getX86TargetCPU. NFCI (details)
  8. [LegalTypes] Move VSELECT node creation out of WidenVSELECTAndMask and push to 2 of the 3 callers. (details)
  9. Add -Wtautological-value-range-compare warning. (details)
  10. Unify the code that updates the ArchSpec after finding a fat binary (details)
  11. [NFC][InstCombine] Tests for  x s/EXACT (-1 << y)  pattern (details)
  12. [NFC][InstCombine] Better tests for  x s/EXACT (1 << y)  pattern (details)
  13. [InstCombine] Generalize  sdiv exact X, 1<<C  -->  ashr exact X, C  fold to handle non-splat vectors (details)
  14. [NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift (details)
  15. [InstCombine] Fold  sdiv exact X, -1<<C  -->  -(ashr exact X, C) (details)
  16. [NFC][InstCombine] Add some more tests for negation sinking into mul (details)
  17. [InstCombine] Generalize  %x * (-1<<C)  -->  (-%x) * (1<<C)  fold (details)
  18. [InstCombine] Fold  (x + C1) * (-1<<C2)  -->  (-C1 - x) * (1<<C2) (details)
  19. [flang][msvc] Do not use gcc/clang command line options for msvc. (details)
Commit ba37b144e6cf7ecaa7e6eb5bb34c02aeaa8a9e3c by Jonas Devlieghere
[LLDB] Skip test_launch_simple from TestTargetAPI.py when remote
The file was modifiedlldb/test/API/python_api/target/TestTargetAPI.py
Commit 250a167c41819aa5cedd290a29e4d3af4a9bafbe by spatel
[InstSimplify] avoid crashing by trying to rem-by-zero

Bug was noted in the post-commit comments for:
rGe8760bb9a8a3
The file was modifiedllvm/test/Transforms/InstSimplify/icmp-constant.ll
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
Commit f406a90a08c3993cd5bfd5e6a546165e55fec9b4 by Adrian Prantl
Add missing override to Makefile
The file was modifiedlldb/test/API/macosx/macCatalyst/Makefile
The file was modifiedlldb/test/API/macosx/macCatalystAppMacOSFramework/Makefile
Commit 8d943a928d254a25caa5a6d2f92f8719c92a9694 by snehasishk
[NFC] Rename BBSectionsPrepare -> BasicBlockSections.

Rename the BBSectionsPrepare pass as suggested by the review comment in
https://reviews.llvm.org/D85368.

Differential Revision: https://reviews.llvm.org/D85380
The file was modifiedllvm/lib/CodeGen/CMakeLists.txt
The file was modifiedllvm/lib/CodeGen/CodeGen.cpp
The file was modifiedllvm/include/llvm/CodeGen/Passes.h
The file was modifiedllvm/include/llvm/InitializePasses.h
The file was addedllvm/lib/CodeGen/BasicBlockSections.cpp
The file was modifiedllvm/lib/CodeGen/TargetPassConfig.cpp
The file was modifiedllvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
The file was removedllvm/lib/CodeGen/BBSectionsPrepare.cpp
Commit 87cba434027bf6ad370629f5b924ebd4543ddabc by yhs
BPF: add a SimplifyCFG IR pass during generic Scalar/IPO optimization

The following bpf linux kernel selftest failed with latest
llvm:
  $ ./test_progs -n 7/10
  ...
  The sequence of 8193 jumps is too complex.
  verification time 126272 usec
  stack depth 320
  processed 114799 insns (limit 1000000)
  ...
  libbpf: failed to load object 'pyperf600_nounroll.o'
  test_bpf_verif_scale:FAIL:110
  #7/10 pyperf600_nounroll.o:FAIL
  #7 bpf_verif_scale:FAIL

After some investigation, I found the following llvm patch
  https://reviews.llvm.org/D84108
is responsible. The patch disabled hoisting common instructions
in SimplifyCFG by default. Later on, the code changes and a
SimplifyCFG phase with hoisting on cannot do the work any more.

A test is provided to demonstrate the problem.
The IR before simplifyCFG looks like:
  for.cond:
    %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
    %cmp = icmp ult i32 %i.0, 6
    br i1 %cmp, label %for.body, label %for.cond.cleanup

  for.cond.cleanup:
    %2 = load i8*, i8** %frame_ptr, align 8, !tbaa !2
    %cmp2 = icmp eq i8* %2, null
    %conv = zext i1 %cmp2 to i32
    call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) #3
    call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #3
    ret i32 %conv

  for.body:
    %3 = load i8*, i8** %frame_ptr, align 8, !tbaa !2
    %tobool.not = icmp eq i8* %3, null
    br i1 %tobool.not, label %for.inc, label %land.lhs.true

The first two insns of `for.cond.cleanup` and `for.body`, load and
icmp, can be hoisted to `for.cond` block. With Patch D84108, the
optimization is delayed. But unfortunately, later on loop rotation
added addition phi nodes to `for.body` and hoisting cannot
be done any more.

Note such a hoisting is beneficial to bpf programs as
bpf verifier does path sensitive analysis and verification.
The hoisting preverts reloading from stack which will assume
conservative value and increase exploited insns. In this case,
it caused verifier failure.

To fix this problem, I added an IR pass from bpf target
to performance additional simplifycfg with hoisting common inst
enabled.

Differential Revision: https://reviews.llvm.org/D85434
The file was addedllvm/test/CodeGen/BPF/simplifycfg.ll
The file was modifiedllvm/lib/Target/BPF/BPFTargetMachine.h
The file was modifiedllvm/lib/Target/BPF/LLVMBuild.txt
The file was modifiedllvm/lib/Target/BPF/BPFTargetMachine.cpp
Commit e1cad4234cf3a3d0747c140e135e413ece22cf63 by craig.topper
[X86] Make getX86TargetCPU return std::string instead of const char *. Remove call to MakeArgString. NFCI

I believe this function used to be called directly from X86
specific code and was used to immediately create -target-cpu
command line. A later refactoring changed it to to be called from
a generic getCPU function that returns std::string. So on some
paths we created a string using MakeArgString converted that to
std::string then called MakeArgString again from that.

Instead just return std::string directly like the other targets.
The file was modifiedclang/lib/Driver/ToolChains/Arch/X86.cpp
The file was modifiedclang/lib/Driver/ToolChains/Arch/X86.h
Commit 4df38a5589f6fa23e161a76bdaa3180ad053791e by craig.topper
[X86] Optimize out a few extra strlen calls in getX86TargetCPU. NFCI

We had a conversion from const char * to StringRef and const char *
to std::string conversion. These both do their own
strlen call if the compiler doens't figure out how to share them.
By adding the temporary StringRef we can convert it to std::string
instead.

The other case is to use a StringSwitch<StringRef> instead of
StringSwitch<const char *> since the output values of the switch
are string literals. This allows the length to be computed at
compile time. Otherwise we have to convert from const char *
to std::string after the StringSwitch.
The file was modifiedclang/lib/Driver/ToolChains/Arch/X86.cpp
Commit ffc248f3b88cd6a0153d23660727b45dde8f27b5 by craig.topper
[LegalTypes] Move VSELECT node creation out of WidenVSELECTAndMask and push to 2 of the 3 callers.

One of the callers only wants the condition, but the vselect can
be simplified by getNode making it hard or impossible to retrieve
the condition.

Instead, return the condition and make the other 2 callers
responsible for creating the vselect node using the condition.
Rename the function to WidenVSELECTMask accordingly.

Differential Revision: https://reviews.llvm.org/D85468
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
The file was addedllvm/test/CodeGen/SystemZ/pr47019.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Commit d6492d874478b1d3b1ce3adb4c3044618bec29e9 by richard
Add -Wtautological-value-range-compare warning.

This warning diagnoses cases where an expression is compared to a
constant, and the comparison is tautological due to the form of the
expression (but not merely due to its type). This applies in cases such
as comparisons of bit-fields and the result of bit-masks.

The new warning is added to the Clang diagnostic group
-Wtautological-constant-in-range-compare but not to the
formerly-equivalent GCC-compatibility diagnostic group -Wtype-limits,
which retains its old meaning of diagnosing only tautological
comparisons to extremal values of a type (eg, int > INT_MAX).

Reviewed By: rtrieu

Differential Revision: https://reviews.llvm.org/D85256
The file was modifiedclang/include/clang/Basic/DiagnosticGroups.td
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was modifiedclang/test/Sema/tautological-constant-compare.c
Commit 0fa520af6734c5f1fab80629337e3f08fd8770db by Adrian Prantl
Unify the code that updates the ArchSpec after finding a fat binary
with how it is done for a lean binary

In particular this affects how target create --arch is handled — it
allowed us to override the deployment target (a useful feature for the
expression evaluator), but the fat binary case didn't.

rdar://problem/66024437

Differential Revision: https://reviews.llvm.org/D85049

(cherry picked from commit 470bdd3caaab0b6e0ffed4da304244be40b78668)
The file was modifiedlldb/source/Target/TargetList.cpp
The file was modifiedlldb/test/API/macosx/universal/TestUniversal.py
The file was modifiedlldb/test/API/macosx/universal/Makefile
Commit 1c21635c94df0e680cbb0797a64d09a63f619fc0 by lebedev.ri
[NFC][InstCombine] Tests for  x s/EXACT (-1 << y)  pattern
The file was addedllvm/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll
Commit 8633a0d985f1abc8f81dba5f699d5df627e6a9f1 by lebedev.ri
[NFC][InstCombine] Better tests for  x s/EXACT (1 << y)  pattern
The file was addedllvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
Commit 442cb88f5344560e49fab681a9c909654d85fcc7 by lebedev.ri
[InstCombine] Generalize  sdiv exact X, 1<<C  -->  ashr exact X, C  fold to handle non-splat vectors
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
The file was modifiedllvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
Commit 47aec80e4afc8e3746e09f4c9d309cf8941f68cc by lebedev.ri
[NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
Commit 7ce76b06ec908a85205d4dc7af6e73d5ecc26251 by lebedev.ri
[InstCombine] Fold  sdiv exact X, -1<<C  -->  -(ashr exact X, C)

While that does increases instruction count,
shift is obviously better than a division.

Name: base
Pre: (1<<C1) >= 0
%o0 = shl i8 1, C1
%r = sdiv exact i8 C0, %o0
  =>
%r = ashr exact i8 C0, C1

Name: neg
%o0 = shl i8 -1, C1
%r = sdiv exact i8 C0, %o0
  =>
%t0 = ashr exact i8 C0, C1
%r = sub i8 0, %t0

Name: reverse
Pre: C1 != 0 && C1 u< 8
%t0 = ashr exact i8 C0, C1
%r = sub i8 0, %t0
  =>
%o0 = shl i8 -1, C1
%r = sdiv exact i8 C0, %o0

https://rise4fun.com/Alive/MRplf
The file was modifiedllvm/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
Commit a404acb86af7d62390a2599bb86bba2c5f840f68 by lebedev.ri
[NFC][InstCombine] Add some more tests for negation sinking into mul
The file was modifiedllvm/test/Transforms/InstCombine/sub-of-negatible.ll
The file was modifiedllvm/test/Transforms/InstCombine/mul.ll
Commit 0c1c756a31536666a7b6f5bdb744dbce923a0c9e by lebedev.ri
[InstCombine] Generalize  %x * (-1<<C)  -->  (-%x) * (1<<C)  fold

Multiplication is commutative, and either of operands can be negative,
so if the RHS is a negated power-of-two, we should try to make it
true power-of-two (which will allow us to turn it into a left-shift),
by trying to sink the negation down into LHS op.

But, we shouldn't re-invent the logic for sinking negation,
let's just use Negator for that.

Tests and original patch by: Simon Pilgrim @RKSimon!

Differential Revision: https://reviews.llvm.org/D85446
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
The file was modifiedllvm/test/Transforms/InstCombine/mul.ll
Commit be02adfad7acf8040ad025b58052b3838db7e23b by lebedev.ri
[InstCombine] Fold  (x + C1) * (-1<<C2)  -->  (-C1 - x) * (1<<C2)

Negator knows how to do this, but the one-use reasoning is getting
a bit muddy here, we don't really want to increase instruction count,
so we need to both lie that "IsNegation" and have an one-use check
on the outermost LHS value.
The file was modifiedllvm/test/Transforms/InstCombine/mul.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
Commit f81bae9ff42f760ed4e3d8f7314a7aee2effe6aa by llvm-project
[flang][msvc] Do not use gcc/clang command line options for msvc.

The command line options `-Wno-error` and `-Wno-unused-parameter` are specific to gcc/clang, do not use them when compiling with other compilers.

This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].

Reviewed By: isuruf

Differential Revision: https://reviews.llvm.org/D85355
The file was modifiedflang/lib/Optimizer/CMakeLists.txt
The file was modifiedflang/lib/Lower/CMakeLists.txt

Summary

  1. [test-suite] remote file sync happens via rsync now. NFC (details)
Commit 350389291e2a1e1dec566596c97919b5569c2f33 by jonathan_roelofs
[test-suite] remote file sync happens via rsync now. NFC
The file was modifiedlitsupport/modules/remote.py (diff)