Go to file
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
clang Fix variable ‘IsInitCapturePack’ set but not used warning. NFCI. 2019-08-29 12:41:19 +00:00
clang-tools-extra Fix MSVC "not all control paths return a value" warning. NFCI. 2019-08-29 12:37:02 +00:00
compiler-rt [sanitizer] Support monorepo layout in symbolizer build script 2019-08-29 02:02:03 +00:00
debuginfo-tests Make nrvo-string test more robust. 2019-06-27 20:38:37 +00:00
libclc Revert "Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC" 2019-08-05 17:23:23 +00:00
libcxx [libc++] Fix visibility of __vector_base_common on GCC 2019-08-28 18:10:39 +00:00
libcxxabi Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory 2019-08-19 23:51:26 +00:00
libunwind [runtimes] Don't depend on libpthread on Android 2019-07-22 20:41:03 +00:00
lld lld: Make a test not fail if "repro" is part of the build directory name 2019-08-28 14:33:35 +00:00
lldb [lldb][NFC] Try fixing TestCompletion.py on Windows 2019-08-29 09:57:02 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm [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
openmp Use target_impl functions to replace more inline asm 2019-08-28 15:04:06 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly [ScopBuilder] Simplify main statement flag in buildEqivClassBlockStmts. NFC. 2019-08-26 21:31:47 +00:00
pstl [pstl] Allow customizing whether per-TU insulation is provided 2019-08-13 12:49:00 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Change /build to /build* in top-level .gitignore. 2019-08-02 02:14:08 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

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