Commit Graph

12368 Commits

Author SHA1 Message Date
Chijun Sima 134b06ddd0 [ADCE] Remove the need of DomTree
Summary: ADCE doesn't need to query domtree.

Reviewers: kuhar, brzycki, dmgreen, davide, grosser

Reviewed By: kuhar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338950 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-04 02:50:12 +00:00
Anastasis Grammenos f8fba9029f [TRE][DebugInfo] Preserve Debug Location in new branch instruction
There are two branch instructions created
so the new test covers them both.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338917 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 20:27:13 +00:00
Hiroshi Inoue ebab95406f [InstSimplify] fold extracting from std::pair (2/2)
This is the second patch of the series which intends to enable jump threading for an inlined method whose return type is std::pair<int, bool> or std::pair<bool, int>. 
The first patch is https://reviews.llvm.org/rL338485.

This patch handles code sequences that merges two values using `shl` and `or`, then extracts one value using `and`.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338817 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 05:39:48 +00:00
Philip Reames fb8aeadb5e [LICM] Remove unneccessary safety check to increase sinking effectiveness
This one requires a bit of explaination.  It's not every day you simply delete code to implement an optimization.  :)

The transform in question is sinking an instruction from a loop to the uses in loop exiting blocks.  We know (from LCSSA) that all of the uses outside the loop must be phi nodes, and after predecessor splitting, we know all phi users must have a single operand.  Since the use must be strictly dominated by the def, we know from the definition of dominance/ssa that the exit block must execute along a (non-strict) subset of paths which reach the def.  As a result, duplicating a potentially faulting instruction can not *introduce* a fault that didn't previously exist in the program.  

The full story is that this patch builds on "rL338671: [LICM] Factor out fault legality from canHoistOrSinkInst [NFC]" which pulled this logic out of a common helper routine.  As best I can tell, this check was originally added to the helper function for hoisting legality, later an incorrect fastpath for loads/calls was added, and then the bug was fixed by duplicating the fault safety check in the hoist path.  This left the redundant check in the common code to pessimize sinking for no reason.  I split it out in an NFC, and am not removing the unneccessary check.  I wanted there to be something easy to revert in case I missed something.

Reviewed by: Anna Thomas (in person)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338794 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 00:21:56 +00:00
Eli Friedman f4a5ef1f00 [GlobalMerge] Allow merging globals with explicit section markings.
At least on ELF, it's impossible to tell from the object file whether
two globals with the same section marking were merged: the merged global
uses "private" linkage to hide its symbol, and the aliases look like
regular symbols. I can't think of any other reason to disallow it.
(Of course, we can only merge globals in the same section.)

The weird alignment handling matches AsmPrinter; our alignment handling
for global variables should probably be refactored.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338791 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 23:54:16 +00:00
David Bolvansky 24c4936dc0 [InstCombine] [NFC] Tests for select with binop fold
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338727 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 14:59:23 +00:00
Sanjay Patel e1c9b76cd3 [InstSimplify] move minnum/maxnum with undef fold from instcombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338719 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 14:33:40 +00:00
Sanjay Patel fd0862123d [ValueTracking] fix maxnum miscompile for cannotBeOrderedLessThanZero (PR37776)
This adds the NAN checks suggested in PR37776:
https://bugs.llvm.org/show_bug.cgi?id=37776

If both operands to maxnum are NAN, that should get constant folded, so we don't 
have to handle that case. This is the same assumption as other FP ops in this
function. Returning 'false' is always conservatively correct.

Copying from the bug report:

Currently, we have this for "when is cannotBeOrderedLessThanZero 
(mustBePositiveOrNaN) true for maxnum":
               L
        -------------------
        | Pos | Neg | NaN |
   ------------------------
   |Pos |  x  |  x  |  x  |
   ------------------------
 R |Neg |  x  |     |  x  |
   ------------------------
   |NaN |  x  |  x  |  x  |
   ------------------------


The cases with (Neg & NaN) are wrong. We should have:

                L
        -------------------
        | Pos | Neg | NaN |
   ------------------------
   |Pos |  x  |  x  |  x  |
   ------------------------
 R |Neg |  x  |     |     |
   ------------------------
   |NaN |  x  |     |  x  |
   ------------------------

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338716 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 13:46:20 +00:00
Philip Reames 218719c51e [LICM] Expand tests to highlight an oddity in sinking implementation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338670 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 03:54:29 +00:00
Sanjay Patel 5ea9eaae86 [InstSimplify] move minnum/maxnum with same arg fold from instcombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338652 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 23:05:55 +00:00
David Bolvansky 8e70a95cbc Revert "Enrich inline messages", tests fail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338496 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 08:02:40 +00:00
David Bolvansky 788bdbbd5c Enrich inline messages
Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.

Patch by: yrouban (Yevgeny Rouban)


Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00

Reviewed By: tejohnson, xbolva00

Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338494 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 07:37:16 +00:00
Hiroshi Inoue d967b3d2e7 [InstSimplify] fold extracting from std::pair (1/2)
This patch intends to enable jump threading when a method whose return type is std::pair<int, bool> or std::pair<bool, int> is inlined.
For example, jump threading does not happen for the if statement in func.

std::pair<int, bool> callee(int v) {
  int a = dummy(v);
  if (a) return std::make_pair(dummy(v), true);
  else return std::make_pair(v, v < 0);
}

int func(int v) {
  std::pair<int, bool> rc = callee(v);
  if (rc.second) {
    // do something
  }

SROA executed before the method inlining replaces std::pair by i64 without splitting in both callee and func since at this point no access to the individual fields is seen to SROA.
After inlining, jump threading fails to identify that the incoming value is a constant due to additional instructions (like or, and, trunc).

This series of patch add patterns in InstructionSimplify to fold extraction of members of std::pair. To help jump threading, actually we need to optimize the code sequence spanning multiple BBs.
These patches does not handle phi by itself, but these additional patterns help NewGVN pass, which calls instsimplify to check opportunities for simplifying instructions over phi, apply phi-of-ops optimization to result in successful jump threading. 
SimplifyDemandedBits in InstCombine, can do more general optimization but this patch aims to provide opportunities for other optimizers by supporting a simple but common case in InstSimplify.

This first patch in the series handles code sequences that merges two values using shl and or and then extracts one value using lshr.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338485 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 04:40:32 +00:00
Evandro Menezes 6baa465afe [PATCH] [SLC] Test simplification of pow() for vector types (NFC)
Add test case for the simplification of `pow()` for vector types that D50035
enables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338463 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 00:30:43 +00:00
Ewan Crawford d9904414c2 Fix InstCombine address space assert
Workaround bug where the InstCombine pass was asserting on the IR added in lit
test, where we have a bitcast instruction after a GEP from an addrspace cast.

The second bitcast in the test was getting combined into
`bitcast <16 x i32>* %0 to <16 x i32> addrspace(3)*`, which looks like it should
be an addrspace cast instruction instead. Otherwise if control flow is allowed
to continue as it is now we create a GEP instruction
`<badref> = getelementptr inbounds <16 x i32>, <16 x i32>* %0, i32 0`. However
because the type of this instruction doesn't match the address space we hit an
assert when replacing the bitcast with that GEP.

```
void llvm::Value::doRAUW(llvm::Value*, bool): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.
```

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 15:53:03 +00:00
Sanjay Patel d3bdf1f29b [InstCombine] regenerate checks and add tests for D50035; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338392 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 15:07:32 +00:00
Anastasis Grammenos c22c96db49 [DebugInfo][LCSSA] Preserve debug location in lcssa phis
Summary:
When inserting lcssa Phi Nodes in the exit block
mak sure to preserve the original instructions DL.

Reviewers: vsk

Subscribers: JDevlieghere, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338391 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:54:52 +00:00
David Bolvansky 757fc2f38e Revert Enrich inline messages
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338389 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:47:22 +00:00
Sanjay Patel 07836bef1a [InstCombine] auto-generate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338388 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:27:30 +00:00
David Bolvansky 99862d39d7 Enrich inline messages
Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.

Patch by: yrouban (Yevgeny Rouban)


Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00

Reviewed By: tejohnson, xbolva00

Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338387 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:25:24 +00:00
John Brawn 9e1f67df4f [MemDep] Use PhiValuesAnalysis to improve alias analysis results
This is being done in order to make GVN able to better optimize certain inputs.
MemDep doesn't use PhiValues directly, but does need to notifiy it when things
get invalidated.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338384 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:19:29 +00:00
David Bolvansky f241788fa5 [InstSimplify] Fold another Select with And/Or pattern
Summary: Proof: https://rise4fun.com/Alive/L5J

Reviewers: lebedev.ri, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:17:15 +00:00
Alexey Bataev 1ae9ed698a [SLP] Fix PR38339: Instruction does not dominate all uses!
Summary:
If the ExtractElement instructions can be optimized out during the
vectorization and we need to reshuffle the parent vector, this
ShuffleInstruction may be inserted in the wrong place causing compiler
to produce incorrect code.

Reviewers: spatel, RKSimon, mkuper, hfinkel, javed.absar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338380 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 14:02:43 +00:00
Sanjay Patel 44442fbe1a [InstCombine] simplify code for A & (A ^ B) --> A & ~B
This fold was written in an odd way and tried to avoid
an endless loop by bailing out on all constants instead
of the supposedly problematic case of -1. But (X & -1) 
should always be simplified before we reach here, so I'm
not sure how that is a problem.

There were no tests for the commuted patterns, so I added
those at rL338364.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338367 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 13:00:03 +00:00
Sanjay Patel f8c29cb84b [InstCombine] move/add tests for xor+add fold; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338364 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 12:31:00 +00:00
Hiroshi Inoue 9325cc92ed [InstSimplify] tests for D48828, D49981: fold extraction from std::pair
Minor touch up in the previous comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338351 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 05:29:20 +00:00
Hiroshi Inoue 24f705031b [InstSimplify] tests for D48828, D49981: fold extraction from std::pair
Updated unit tests for D48828 and D49981.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338350 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 05:10:36 +00:00
David Bolvansky a5603d18b0 [InstCombine] Fold Select with binary op
Summary:
Fold
  %A = icmp eq i8 %x, 0
  %B = xor i8 %x, %z
  %C = select i1 %A, i8 %B, i8 %y
To
  %C = select i1 %A, i8 %z, i8 %y

Fixes https://bugs.llvm.org/show_bug.cgi?id=38345
Proof: https://rise4fun.com/Alive/43J

Reviewers: lebedev.ri, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338300 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 20:38:53 +00:00
Manoj Gupta b22576f80d [Inline] Copy "null-pointer-is-valid" attribute in caller.
Summary:
Normally, inling does not happen if caller does not have
"null-pointer-is-valid"="true" attibute but callee has it.

However, alwaysinline may force callee to be inlined.
In this case, if the caller has the "null-pointer-is-valid"="true"
attribute, copy the attribute to caller.

Reviewers: efriedma, a.elovikov, lebedev.ri, jyknight

Reviewed By: efriedma

Subscribers: eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338292 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 19:33:53 +00:00
David Bolvansky 7e678dc65b [InstSimplify] [NFC] Tests for Select with AND/OR fold
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338285 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 18:22:18 +00:00
Evandro Menezes fb73e7ba91 [SLC] Refactor the simplication of pow() (NFC)
Use more meaningful variable names.  Mostly NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338266 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 16:20:04 +00:00
David Bolvansky b8b1cb30e7 [InstCombine] [NFC] Added tests for Select with binop fold
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338257 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 15:38:42 +00:00
John Brawn df2b9399fe [BasicAA] Use PhiValuesAnalysis if available when handling phi alias
By using PhiValuesAnalysis we can get all the values reachable from a phi, so
we can be more precise instead of giving up when a phi has phi operands. We
can't make BaseicAA directly use PhiValuesAnalysis though, as the user of
BasicAA may modify the function in ways that PhiValuesAnalysis can't cope with.

For this optional usage to work correctly BasicAAWrapperPass now needs to be not
marked as CFG-only (i.e. it is now invalidated even when CFG is preserved) due
to how the legacy pass manager handles dependent passes being invalidated,
namely the depending pass still has a pointer to the now-dead dependent pass.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338242 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 11:52:08 +00:00
Sanjay Patel 19a2e2a495 [InstCombine] try to fold 'add+sub' to 'not+add'
These are reassociated versions of the same pattern and
similar transforms as in rL338200 and rL338118.

The motivation is identical to those commits:
Patterns with add/sub combos can be improved using
'not' ops. This is better for analysis and may lead
to follow-on transforms because 'xor' and 'add' are
commutative/associative. It can also help codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338221 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-29 18:13:16 +00:00
Sanjay Patel 02b53da6b6 [InstCombine] add tests for another sub-not variant; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338220 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-29 18:07:28 +00:00
Sanjay Patel 5c9b7b9b82 [InstSimplify] fold funnel shifts with 0-shift amount
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338218 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-29 16:36:38 +00:00
Sanjay Patel c817c924d5 [InstSimplify] add tests for funnel shift intrinsics; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338217 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-29 16:27:17 +00:00
David Bolvansky 8a20db3673 [InstCombine] Tests for fold Select with binary op
Differential Revision: https://reviews.llvm.org/D49961

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338201 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 17:13:33 +00:00
Sanjay Patel bd68890e8f [InstCombine] try to fold 'sub' to 'not'
https://rise4fun.com/Alive/jDd

Patterns with add/sub combos can be improved using
'not' ops. This is better for analysis and may lead
to follow-on transforms because 'xor' and 'add' are 
commutative/associative. It can also help codegen.  


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338200 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 16:48:44 +00:00
David Bolvansky 6f476979f9 [InstSimplify] Moved Select + AND/OR tests from InstCombine
Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338195 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 13:52:45 +00:00
David Green d38f49543e [GlobalOpt] Test array indices inside structs for out-of-bounds accesses
We now, from clang, can turn arrays of
  static short g_data[] = {16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0};
into structs of the form
  @g_data = internal global <{ [8 x i16], [8 x i16] }> ...

GlobalOpt will incorrectly SROA it, not realising that the access to the first
element may overflow into the second. This fixes it by checking geps more
thoroughly.

I believe this makes the globalsra-partial.ll test case invalid as the %i value
could be out of bounds. I've re-purposed it as a negative test for this case.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 08:20:10 +00:00
David Bolvansky cf073c23aa [InstCombine] Fold Select with AND/OR condition
Summary:
Fold
```
%A = icmp ne i8 %X, %V1
%B = icmp ne i8 %X, %V2
%C = or i1 %A, %B
%D = select i1 %C, i8 %X, i8 %V1
ret i8 %D
  =>
ret i8 %X

Fixes https://bugs.llvm.org/show_bug.cgi?id=38334
Proof: https://rise4fun.com/Alive/plI8

Reviewers: spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: craig.topper, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338191 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 06:55:51 +00:00
David Bolvansky 4cca12faa6 [InstCombine] [NFC] [Tests] Fold Select with AND/OR condition - fixed
Differential Revision: https://reviews.llvm.org/D49933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338161 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 20:29:32 +00:00
David Bolvansky 8ab74e6b40 [InstCombine] [NFC] [Tests] Fold Select with AND/OR condition
Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338159 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 20:18:12 +00:00
Evandro Menezes ea66136bc8 [SLC] Test simplification of pow(x, 0.333...) to cbrt(x) (NFC)
Add test case for simplifying `pow(x, 0.333...)` into `cbrt(x)`, which
D49040 enables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338152 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 18:56:47 +00:00
Sanjay Patel 4582fbe062 [InstCombine] not(sub X, Y) --> add (not X), Y
The tests with constants show a missing optimization.
Analysis for adds is better than subs, so this can also
help with other transforms. And codegen is better with 
adds for targets like x86 (destructive ops, no sub-from).

https://rise4fun.com/Alive/llK


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338118 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 10:54:48 +00:00
Sanjay Patel 9ac57f95b0 [InstCombine] add tests for not+sub; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 10:45:04 +00:00
Max Kazantsev 9c24b380dc [SimplifyIndVar] Canonicalize comparisons to unsigned while eliminating truncs
This is a follow-up for the patch rL335020. When we replace compares against
trunc with compares against wide IV, we can also replace signed predicates with
unsigned where it is legal.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D48763


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338115 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 09:43:39 +00:00
Anastasis Grammenos e4b8312715 Revert "[LV][DebugInfo] Set DL to the middle block Icmp instruction"
This reverts commit r338106.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338109 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 08:22:54 +00:00
Hiroshi Inoue 7eb8348d10 [InstSimplify] tests for D48828: fold extraction from std::pair
This commit includes unit tests for D48828, which enhances InstSimplify to enable jump threading with a method whose return type is std::pair<int, bool> or std::pair<bool, int>.
I am going to commit the actual transformation later.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338107 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 07:21:02 +00:00