Page MenuHomePhabricator

[Bugpoint redesign] Added pass to reduce Basic Blocks
ClosedPublic

Authored by diegotf on Aug 15 2019, 4:26 PM.

Details

Summary

This pass tries to remove uninteresting Basic Blocks. Note: it also removes them from any SwInst, BranchInst and IndirectBrInst that references them.

Diff Detail

Event Timeline

diegotf created this revision.Aug 15 2019, 4:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2019, 4:26 PM
diegotf updated this revision to Diff 215698.Aug 16 2019, 3:46 PM

Added test & fixed a bug where SwitchInst were not being replaced

This revision was not accepted when it landed; it landed in state Needs Review.Sep 18 2019, 2:46 PM
This revision was automatically updated to reflect the committed changes.
hctim added a subscriber: hctim.Sep 19 2019, 12:58 PM

Looks like this broke the sanitizer buildbots - I'll confirm that a revert fixes and will follow up with it:

FAIL: LLVM :: Reduce/remove-bbs.ll (25951 of 33613)
******************** TEST 'LLVM :: Reduce/remove-bbs.ll' FAILED ********************
Script:
--
: 'RUN: at line 4';   llvm-reduce --test "/usr/bin/python" --test-arg /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Reduce/Inputs/remove-bbs.py /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Reduce/remove-bbs.ll -o /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Reduce/Output/remove-bbs.ll.tmp
: 'RUN: at line 5';   cat /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Reduce/Output/remove-bbs.ll.tmp | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck -implicit-check-not=uninteresting /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Reduce/remove-bbs.ll
--
Exit Code: 77

Command Output (stderr):
--
*** Reducing Functions...
----------------------------
Function Index Reference:
	1: main
----------------------------
Increasing granularity...
Already at minimum size. Cannot reduce anymore.
----------------------------
Increasing granularity...Success! New Chunks:
	[1,2]
	[3,4]
==2672==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4d69bb in replaceBranchTerminator /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp:54:12
    #1 0x4d69bb in extractBasicBlocksFromModule(std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> >, llvm::Module*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp:114
    #2 0x4c61c9 in __invoke<void (*&)(std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> >, llvm::Module *), const std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> > &, llvm::Module *> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/type_traits:3501:1
    #3 0x4c61c9 in void std::__1::__invoke_void_return_wrapper<void>::__call<void (*&)(std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> >, llvm::Module*), std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> > const&, llvm::Module*>(void (*&)(std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> >, llvm::Module*), std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> > const&, llvm::Module*&&) /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/__functional_base:348
    #4 0x4b7607 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/functional:1867:16
    #5 0x4b7607 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/functional:2473
    #6 0x4b7607 in llvm::runDeltaPass(llvm::TestRunner&, int, std::__1::function<void (std::__1::vector<llvm::Chunk, std::__1::allocator<llvm::Chunk> > const&, llvm::Module*)>) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/deltas/Delta.cpp:132
    #7 0x4d4170 in llvm::reduceBasicBlocksDeltaPass(llvm::TestRunner&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp:145:3
    #8 0x4ad562 in runDeltaPasses /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/DeltaManager.h:28:3
    #9 0x4ad562 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/llvm-reduce.cpp:88
    #10 0x7f9ec536f2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #11 0x436ef9 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llvm-reduce+0x436ef9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp:54:12 in replaceBranchTerminator