llvm-project/llvm/lib
Roman Lebedev 9f35d2b564 [SimplifyCFG] FoldTwoEntryPHINode(): don't bailout on i1 PHI's if we can hoist a 'not' from incoming values
Summary:
As it can be seen in the tests in D65143/D65144, even though we have formed an '@llvm.umul.with.overflow'
and got rid of potential for division-by-zero, the control flow remains, we still have that branch.

We have this condition:
```
  // Don't fold i1 branches on PHIs which contain binary operators
  // These can often be turned into switches and other things.
  if (PN->getType()->isIntegerTy(1) &&
      (isa<BinaryOperator>(PN->getIncomingValue(0)) ||
       isa<BinaryOperator>(PN->getIncomingValue(1)) ||
       isa<BinaryOperator>(IfCond)))
    return false;
```
which was added back in rL121764 to help with `select` formation i think?

That check prevents us to flatten the CFG here, even though we know
we no longer need that guard and will be able to drop everything
but the '@llvm.umul.with.overflow' + `not`.

As it can be seen from tests, we end here because the `not` is being
sinked into the PHI's incoming values by InstCombine,
so we can't workaround this by hoisting it to after PHI.

Thus i suggest that we relax that check to not bailout if we'd get to hoist the `not`.

Reviewers: craig.topper, spatel, fhahn, nikic

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 370349
2019-08-29 12:47:34 +00:00
..
Analysis [CostModel] Model all `extractvalue`s as free. 2019-08-29 11:50:30 +00:00
AsmParser [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
BinaryFormat [BinaryFormat] Teach identify_magic about Tapi files. 2019-08-21 21:00:16 +00:00
Bitcode Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
Bitstream [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
CodeGen [DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations 2019-08-29 11:20:54 +00:00
DebugInfo Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
Demangle llvm-undname: Correctly demangle vararg parameters 2019-06-04 19:10:08 +00:00
ExecutionEngine [ORCv2] - New Speculate Query Implementation 2019-08-27 18:23:36 +00:00
FuzzMutate [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Fuzzer
IR [FPEnv] Add fptosi and fptoui constrained intrinsics. 2019-08-28 16:33:36 +00:00
IRReader
LTO Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
LineEditor [CMake] Delete redundant DEPENDS/LINK_LIBS from LineEditor/XRay 2019-06-22 01:50:21 +00:00
Linker Linker: Add support for GlobalIFunc. 2019-08-08 22:09:18 +00:00
MC Handle local commons for XCOFF object file writing 2019-08-27 15:14:45 +00:00
MCA [Tblgen][MCA] Add the ability to mark groups as LoadQueue and StoreQueue. NFCI 2019-08-27 18:20:34 +00:00
Object [COFF] Add a ResourceSectionRef method for getting the data entry, print it in llvm-readobj 2019-08-29 09:00:14 +00:00
ObjectYAML [yaml2obj] - Allow placing local symbols after globals. 2019-08-29 10:58:47 +00:00
Option [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Passes [LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it. 2019-08-21 17:00:57 +00:00
ProfileData Ignore object files that lack coverage information. 2019-08-28 20:35:50 +00:00
Remarks Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
Support Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
TableGen [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Target [ARM] MVE Masked loads and stores 2019-08-29 10:54:35 +00:00
Testing [Testing] Move clangd::Annotations to llvm testing support 2019-04-25 10:08:31 +00:00
TextAPI [TextAPI] Update reader to be supported by lib/Object 2019-08-16 15:30:48 +00:00
ToolDrivers [llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports 2019-08-23 11:18:11 +00:00
Transforms [SimplifyCFG] FoldTwoEntryPHINode(): don't bailout on i1 PHI's if we can hoist a 'not' from incoming values 2019-08-29 12:47:34 +00:00
WindowsManifest Fight a bit against global initializers. NFC. 2019-08-22 19:43:27 +00:00
XRay [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CMakeLists.txt Fix build errors LLVM tests are disabled. 2019-07-11 22:08:35 +00:00
LLVMBuild.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00