SuccessChanges

Summary

  1. Test commit: add valid punctuation to a comment. NFC. (details)
  2. [ASTImporter] Add support for importing GenericSelectionExpr AST nodes. (details)
  3. Disable Jump Threading for the targets with divergent control flow (details)
  4. [MBP] Add whole chain to BlockFilterSet instead of individual BB (details)
Commit f31e9bcd73eb5f99256a19ae8ed958140ba58a42 by tmroeder
Test commit: add valid punctuation to a comment. NFC.
The file was modifiedclang/lib/AST/ASTImporter.cpp
Commit 1844ab770cb9380a1896d83b1863b93766ffdf22 by tmroeder
[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter. Additionally, this change adds support for structural
equivalence of _Generic in the AST.

Reviewed By: martong, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92600
The file was modifiedclang/lib/ASTMatchers/ASTMatchersInternal.cpp
The file was addedclang/test/ASTMerge/generic-selection-expr/test.cpp
The file was modifiedclang/lib/Analysis/ExprMutationAnalyzer.cpp
The file was modifiedclang/lib/AST/ASTImporter.cpp
The file was modifiedclang/lib/AST/ASTStructuralEquivalence.cpp
The file was addedclang/test/ASTMerge/generic-selection-expr/test.c
The file was modifiedclang/unittests/AST/ASTImporterTest.cpp
The file was modifiedclang/lib/ASTMatchers/Dynamic/Registry.cpp
The file was addedclang/test/ASTMerge/generic-selection-expr/Inputs/generic.cpp
The file was modifiedclang/unittests/AST/StructuralEquivalenceTest.cpp
The file was addedclang/test/ASTMerge/generic-selection-expr/Inputs/generic.c
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
The file was modifiedclang/docs/LibASTMatchersReference.html
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
Commit 35ec3ff76dee376661dd7e4971b80533a7a7f364 by Alexander Timofeev
Disable Jump Threading for the targets with divergent control flow

Details: Jump Threading does not make sense for the targets with divergent CF
         since they do not use branch prediction for speculative execution.
         Also in the high level IR there is no enough information to conclude that the branch is divergent or uniform.
         This may cause errors in further CF lowering.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D93302
The file was modifiedllvm/lib/Transforms/Scalar/JumpThreading.cpp
The file was addedllvm/test/Transforms/JumpThreading/divergent-target-test.ll
Commit 687e80be7fcf75900c354152d8b21500c3b08850 by carrot
[MBP] Add whole chain to BlockFilterSet instead of individual BB

Currently we add individual BB to BlockFilterSet if its frequency satisfies

  LoopFreq / Freq <= LoopToColdBlockRatio

LoopFreq is edge frequency from outside to loop header.
LoopToColdBlockRatio is a command line parameter.

It doesn't make sense since we always layout whole chain, not individual BBs.

It may also cause a tricky problem. Sometimes it is possible that the LoopFreq
of an inner loop is smaller than LoopFreq of outer loop. So a BB can be in
BlockFilterSet of inner loop, but not in BlockFilterSet of outer loop,
like .cold in the test case. So it is added to the chain of inner loop. When
work on the outer loop, .cold is not added to BlockFilterSet, so the edge to
successor .problem is not counted in UnscheduledPredecessors of .problem chain.
But other blocks in the inner loop are added BlockFilterSet, so the whole inner
loop chain can be layout, and markChainSuccessors is called to decrease
UnscheduledPredecessors of following chains. markChainSuccessors calls
markBlockSuccessors for every BB, even it is not in BlockFilterSet, like .cold,
so .problem chain's UnscheduledPredecessors is decreased, but this edge was not
counted on in fillWorkLists, so .problem chain's UnscheduledPredecessors
becomes 0 when it still has an unscheduled predecessor .pred! And it causes
problems in following various successor BB selection algorithms.

Differential Revision: https://reviews.llvm.org/D89088
The file was addedllvm/test/CodeGen/X86/block_set.ll
The file was modifiedllvm/lib/CodeGen/MachineBlockPlacement.cpp