DominatorTreeAnalysis is always required by instsimplify.
Details
- Reviewers
davidxl danielcdh - Commits
- rG3857f8f0ac48: Explicitly require DominatorTreeAnalysis pass for instsimplify pass.
rGe573b777726a: Explicitly require DominatorTreeAnalysis pass for instsimplify pass.
rL280760: Explicitly require DominatorTreeAnalysis pass for instsimplify pass.
rL280432: Explicitly require DominatorTreeAnalysis pass for instsimplify pass.
Diff Detail
Event Timeline
saw a bunch of buildbot failure pointing to this one, thus revert the change, investigating...
Looks like the buildbot failure are due to the other patch. But I'll hold off until I get an approval before I commit the patch again.
Change #123918
Changed by alexshap
Changed at Thu 01 Sep 2016 17:00:30
Repository http://llvm.org/svn/llvm-project
Project clang-tools-extra
Branch trunk
Revision 280431
Comments
Add clang-reorder-fields to clang-tools-extra
This diff adds v0 of clang-reorder-fields tool to clang/tools/extra.
The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when
someone needs to change the order fields of a struct/class (for example to remove excess padding).
Differential revision: https://reviews.llvm.org/D23279
Changed files
CMakeLists.txt
clang-reorder-fields
clang-reorder-fields/CMakeLists.txt
clang-reorder-fields/ReorderFieldsAction.cpp
clang-reorder-fields/ReorderFieldsAction.h
clang-reorder-fields/tool
clang-reorder-fields/tool/CMakeLists.txt
clang-reorder-fields/tool/ClangReorderFields.cpp
test/CMakeLists.txt
test/clang-reorder-fields
test/clang-reorder-fields/AggregatePartialInitialization.cpp
test/clang-reorder-fields/CStructAmbiguousName.cpp
test/clang-reorder-fields/CStructFieldsOrder.cpp
test/clang-reorder-fields/ClassDifferentFieldsAccesses.cpp
test/clang-reorder-fields/ClassMixedInitialization.cpp
test/clang-reorder-fields/ClassSimpleCtor.cpp
When I enable LoopSink pass, I need to add InstSimplifierPass pass after it to do some cleanup. However, if I directly invoke InstSimplifierPass pass, it will fail due to lack of DT.
From the InstSimplifierPass implementation, it uses DT without checking if it is nullptr. So I think we should explicitly require DT for this pass.
A typical use of DT from InstSimplifierPass is:
llvm::SimplifyInstruction->
llvm::SimplifyICmpInst->
SimplifyICmpInst ->
computePointerICmp->
llvm::isKnownNonNullAt (ValueTracking.cpp) ->
isKnownNonNullFromDominatingCondition (ValueTracking.cpp) ->
llvm::DominatorTree::dominates (Dominators.cpp)
The change seems fine, but you should add a test that demonstrates the failure. Any IR input that triggers the code path you suggest run with just the inst simplify pass from opt should suffice?