15 Commits

Author SHA1 Message Date
SahilPatidar
4b483ecd55
[InstCombine] Fix failure to fold (and %x, (sext i1 %m)) -> (select %m, %x, 0) with multiple uses of %m (#81409)
Resolves #81288.
2024-02-19 11:07:16 +01:00
Nikita Popov
5918f62301
[InstCombine] Infer zext nneg flag (#71534)
Use KnownBits to infer the nneg flag on zext instructions.

Currently we only set nneg when converting sext -> zext, but don't set
it when we have a zext in the first place. If we want to use it in
optimizations, we should make sure the flag inference is consistent.
2023-11-08 09:34:40 +01:00
Yingwei Zheng
4c241a9335
[InstCombine] Fold (-1 + A) & B into A ? 0 : B where A is effectively a bool
Solves issue https://github.com/llvm/llvm-project/issues/63321.

This patch explicitly folds `(-1 + A) & B` into `A ? 0 : B`. Additional trunc will be created when `A` is neither i1 nor <N x i1>.

https://alive2.llvm.org/ce/z/pWv9jJ

Reviewed By: goldstein.w.n

Differential Revision: https://reviews.llvm.org/D153148
2023-09-24 19:10:47 +08:00
Yingwei Zheng
71d225863f
[InstCombine] Add test cases from PR63321. NFC.
This patch adds some test cases from https://github.com/llvm/llvm-project/issues/63321.

It is the first part of D153148.

Differential Revision: https://reviews.llvm.org/D154187
2023-09-24 19:07:55 +08:00
Sanjay Patel
cb9569049c [InstCombine] fold mask with not-of-sext-bool to select
~sext(A) & Op1 --> A ? 0 : Op1

With no extra uses, this pattern is already reduced,
but we would miss it in examples such as issue #59773.

https://alive2.llvm.org/ce/z/WGLcSR
2023-01-02 13:33:28 -05:00
Sanjay Patel
871c415f2d [InstCombine] add tests for not-sext-bool+mask; NFC 2023-01-02 13:33:28 -05:00
Bjorn Pettersson
acdc419c89 [test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC
Another step moving away from the deprecated syntax of specifying
pass pipeline in opt.

Differential Revision: https://reviews.llvm.org/D119081
2022-02-07 14:26:59 +01:00
Sanjay Patel
8bfcf1ab6c [InstCombine] move/add tests for binops with sext operand; NFC 2021-11-22 14:43:57 -05:00
Eric Christopher
cee313d288 Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

llvm-svn: 358552
2019-04-17 04:52:47 +00:00
Eric Christopher
a863435128 Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

llvm-svn: 358546
2019-04-17 02:12:23 +00:00
Edward O'Callaghan
cbf75a5dc3 Convert the rest of the InstCombine tests from notcast to FileCheck.
llvm-svn: 83828
2009-10-12 07:18:14 +00:00
Dan Gohman
72a13d2476 Use opt -S instead of piping bitcode output through llvm-dis.
llvm-svn: 81257
2009-09-08 22:34:10 +00:00
Dan Gohman
9737a63ed8 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.

llvm-svn: 81226
2009-09-08 16:50:01 +00:00
Reid Spencer
2441c0ae3e Fix a test test llvm.exp found.
llvm-svn: 36006
2007-04-14 18:33:31 +00:00
Reid Spencer
83b3d82672 Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
2007-01-17 07:59:14 +00:00