1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/InstSimplify
Roman Lebedev d746d62b1a [ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267)
Summary:
It is pretty common to assume that something is not zero.
Even optimizer itself sometimes emits such assumptions
(e.g. `addAssumeNonNull()` in `PromoteMemoryToRegister.cpp`).

But we currently don't deal with such assumptions :)
The only way `isKnownNonZero()` handles assumptions is
by calling `computeKnownBits()` which calls `computeKnownBitsFromAssume()`.
But `x != 0` does not tell us anything about set bits,
it only says that there are *some* set bits.
So naturally, `KnownBits` does not get populated,
and we fail to make use of this assumption.

I propose to deal with this special case by special-casing it
via adding a `isKnownNonZeroFromAssume()` that returns boolean
when there is an applicable assumption.

While there, we also deal with other predicates,
mainly if the comparison is with constant.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=43267 | PR43267 ]].

Differential Revision: https://reviews.llvm.org/D71660
2019-12-20 01:47:57 +03:00
..
2010-12-20-Boolean.ll
2011-01-14-Thread.ll
2011-02-01-Vector.ll
2011-09-05-InsertExtractValue.ll
2011-10-27-BinOpCrash.ll
2011-11-23-MaskedBitsCrash.ll
2013-04-19-ConstantFoldingCrash.ll
add-mask.ll
add.ll
addsub.ll
and-icmps-same-ops.ll
and-or-icmp-zero.ll
AndOrXor.ll
assume-non-zero.ll [ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267) 2019-12-20 01:47:57 +03:00
assume.ll
bitcast-vector-fold.ll
bitreverse-fold.ll
bitreverse.ll
bswap.ll
call.ll [InstSimplify] fold copysign with negated operand, part 2 2019-12-08 10:16:29 -05:00
cast-unsigned-icmp-cmp-0.ll
cast.ll
cmp_of_min_max.ll
compare.ll
constantfold-add-nuw-allones-to-allones.ll
constantfold-shl-nuw-C-to-C.ll
dead-code-removal.ll
div-by-0-guard-before-smul_ov-not.ll [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow inverted overflow bit 2019-08-29 12:48:04 +00:00
div-by-0-guard-before-smul_ov.ll [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow overflow bit 2019-08-29 12:47:50 +00:00
div-by-0-guard-before-umul_ov-not.ll [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow inverted overflow bit 2019-08-29 12:48:04 +00:00
div-by-0-guard-before-umul_ov.ll [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow overflow bit 2019-08-29 12:47:50 +00:00
div.ll
exact-nsw-nuw.ll
extract-element.ll
fast-math.ll
fcmp-select.ll [InstSimplify] use FMF to improve fcmp+select fold 2019-11-04 08:29:56 -05:00
fdiv.ll
floating-point-arithmetic.ll
floating-point-compare.ll
fold-intrinsics.ll
fp-nan.ll
fp-undef.ll
freeze.ll Add InstCombine/InstructionSimplify support for Freeze Instruction 2019-11-12 12:13:26 +09:00
gep.ll
icmp-abs-nabs.ll [ValueTracking] When calculating known bits for integer abs, make sure we're looking at a negate and not just any instruction with the nsw flag set. 2019-08-07 18:28:16 +00:00
icmp-bool-constant.ll
icmp-constant.ll
icmp-ranges.ll
implies.ll
insertelement.ll [InstSimplify] guard against unreachable code (PR43218) 2019-09-04 15:12:55 +00:00
known-never-nan.ll [ValueTracking] Add a basic version of isKnownNonInfinity and use it to detect more NoNaNs 2019-11-19 22:24:46 +01:00
known-non-zero.ll [ValueTracking] Allow context-sensitive nullness check for non-pointers 2019-12-09 15:15:52 -06:00
load-relative-32.ll
load-relative.ll
load.ll
log2-pow2-intrinsic.ll
log10-pow10-intrinsic.ll
log-exp-intrinsic.ll
logic-of-fcmps.ll
maxmin.ll
mul.ll
negate.ll
noalias-ptr.ll
or-icmps-same-ops.ll
or.ll
past-the-end.ll
phi.ll
pr28725.ll
pr33957.ll
ptr_diff.ll
reassociate.ll
redundant-null-check-in-uadd_with_overflow-of-nonnull-ptr.ll [InstSimplify] Pass SimplifyQuery into simplifyUnsignedRangeCheck() and use it for isKnownNonZero() 2019-09-11 15:32:46 +00:00
rem.ll
remove-dead-call.ll [InstSimplify] Report "Changed" also when only deleting dead instructions 2019-08-09 07:08:25 +00:00
require-dominator.ll
result-of-add-of-negative-is-non-zero-and-no-underflow.ll [NFC][InstSimplify] Add some more tests for D67498/D67502 2019-09-13 17:58:24 +00:00
result-of-usub-by-nonzero-is-non-zero-and-no-overflow.ll [InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251) 2019-09-12 09:26:17 +00:00
result-of-usub-is-non-zero-and-no-overflow.ll [InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251) 2019-09-25 22:59:41 +00:00
returned.ll
round-intrinsics.ll
saturating-add-sub.ll
sdiv.ll
select-and-cmp.ll
select-implied.ll
select-or-cmp.ll
select.ll
shift-128-kb.ll
shift-knownbits.ll
shift.ll
shr-nop.ll
shr-scalar-vector-consistency.ll
shufflevector.ll [InstSimplify] fold splat of inserted constant to vector constant 2019-12-15 09:32:03 -05:00
signed-div-rem.ll
simplify-nested-bitcast.ll
srem.ll
sub.ll
undef.ll
unsigned-range-checks.ll [InstSimplify] simplifyUnsignedRangeCheck(): X >= Y && Y == 0 --> Y == 0 2019-09-21 22:27:39 +00:00
vec-cmp.ll
vector_gep.ll
vector_ptr_bitcast.ll