Go to file
Mikael Holmen 4d652c4ce7 [CloneFunction] Constant fold terminators before checking single predecessor
Summary:
This fixes PR31105.

There is code trying to delete dead code that does so by e.g. checking if
the single predecessor of a block is the block itself.

That check fails on a block like this
 bb:
   br i1 undef, label %bb, label %bb
since that has two (identical) predecessors.

However, after the check for dead blocks there is a call to
ConstantFoldTerminator on the basic block, and that call simplifies the
block to
 bb:
   br label %bb

Therefore we now do the call to ConstantFoldTerminator before the check if
the block is dead, so it can realize that it really is.

The original behavior lead to the block not being removed, but it was
simplified as above, and then we did a call to
    Dest->replaceAllUsesWith(&*I);
with old and new being equal, and an assertion triggered.

Reviewers: chandlerc, fhahn

Reviewed By: fhahn

Subscribers: eraman, llvm-commits

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

llvm-svn: 340820
2018-08-28 12:40:11 +00:00
clang [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments 2018-08-28 08:41:15 +00:00
clang-tools-extra [clangd] Remove unused parameter. NFC 2018-08-28 11:04:07 +00:00
compiler-rt [XRay][compiler-rt] Remove uses of internal allocator in profiling mode 2018-08-28 10:41:10 +00:00
debuginfo-tests Revert "(Retry) Add a basic integration test for C++ smart pointers" 2018-08-20 19:53:33 +00:00
libclc amdgcn: Use __constant AS for amdgcn builtins. 2018-08-03 15:14:08 +00:00
libcxx Fix ODR violation: namespace-scope helpers should not be declared 'static'. 2018-08-27 21:41:50 +00:00
libcxxabi Port my recent changes from LLVM copy of the demangler: 2018-08-24 23:30:26 +00:00
libunwind NFC: Test commit access 2018-08-16 16:55:07 +00:00
lld [LLD][ELF] - Simplify Call-Chain Clustering implementation a bit. 2018-08-28 08:49:40 +00:00
lldb Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running 2018-08-27 23:06:38 +00:00
llgo Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
llvm [CloneFunction] Constant fold terminators before checking single predecessor 2018-08-28 12:40:11 +00:00
openmp [OpenMP][Fix] Conditional compilation leaves variables unused 2018-08-27 19:54:26 +00:00
parallel-libs Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
polly [IR] Replace `isa<TerminatorInst>` with `isTerminator()`. 2018-08-26 09:51:22 +00:00
README.md

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.