summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis/ValueTrackingTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Infer lowest bits of an integer Multiply when the low bits of the operands ↵Simon Dardis2017-12-091-0/+55
| | | | | | | | | | | | | | | are known When the lowest bits of the operands to an integer multiply are known, the low bits of the result are deducible. Code to deduce known-zero bottom bits already existed, but this change improves on that by deducing known-ones. Patch by: Pedro Ferreira Reviewers: craig.topper, sanjoy, efriedma Differential Revision: https://reviews.llvm.org/D34029 llvm-svn: 320269
* [ValueTracking] Avoid undefined behavior in unittest by not making a named ↵Craig Topper2017-04-141-1/+1
| | | | | | | | | | | | ArrayRef from a std::initializer_list One of the ValueTracking unittests creates a named ArrayRef initialized by a std::initializer_list. The underlying array for an std::initializer_list is only guaranteed to have a lifetime as long as the initializer_list object itself. So this can leave the ArrayRef pointing at an array that no long exists. This fixes this to just create an explicit array instead of an ArrayRef. Differential Revision: https://reviews.llvm.org/D32089 llvm-svn: 300354
* Fix signed-unsigned comparison warningSanjoy Das2017-02-251-1/+1
| | | | llvm-svn: 296274
* [ValueTracking] Don't do an unchecked shift in ComputeNumSignBitsSanjoy Das2017-02-251-0/+19
| | | | | | | | | | | | | | | | | | | | | | Summary: Previously we used to return a bogus result, 0, for IR like `ashr %val, -1`. I've also added an assert checking that `ComputeNumSignBits` at least returns 1. That assert found an already checked in test case where we were returning a bad result for `ashr %val, -1`. Fixes PR32045. Reviewers: spatel, majnemer Reviewed By: spatel, majnemer Subscribers: efriedma, mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D30311 llvm-svn: 296273
* Fix an issue with isGuaranteedToTransferExecutionToSuccessorSanjoy Das2016-12-311-0/+51
| | | | | | | | | | | | | | I'm not sure if this was intentional, but today isGuaranteedToTransferExecutionToSuccessor returns true for readonly and argmemonly calls that may throw. This commit changes the function to not implicitly infer nounwind this way. Even if we eventually specify readonly calls as not throwing, isGuaranteedToTransferExecutionToSuccessor is not the best place to infer that. We should instead teach FunctionAttrs or some other such pass to tag readonly functions / calls as nounwind instead. llvm-svn: 290794
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-1/+2
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* [ValueTracking] Minor comment change in testJames Molloy2015-09-021-2/+1
| | | | | | This test was updated in r246678 - fix a copypasta in a comment noticed post-commit. llvm-svn: 246679
* [ValueTracking] Look through casts when both operands are casts.James Molloy2015-09-021-0/+42
| | | | | | | | | | | We only looked through casts when one operand was a constant. We can also look through casts when both operands are non-constant, but both are in fact the same cast type. For example: %1 = icmp ult i8 %a, %b %2 = zext i8 %a to i32 %3 = zext i8 %b to i32 %4 = select i1 %1, i32 %2, i32 %3 llvm-svn: 246678
* Add support for floating-point minnum and maxnumJames Molloy2015-08-111-0/+148
The select pattern recognition in ValueTracking (as used by InstCombine and SelectionDAGBuilder) only knew about integer patterns. This teaches it about minimum and maximum operations. matchSelectPattern() has been extended to return a struct containing the existing Flavor and a new enum defining the pattern's behavior when given one NaN operand. C minnum() is defined to return the non-NaN operand in this case, but the idiomatic C "a < b ? a : b" would return the NaN operand. ARM and AArch64 at least have different instructions for these different cases. llvm-svn: 244580
OpenPOWER on IntegriCloud