Page MenuHomePhabricator

nikic (Nikita Popov)
User

Projects

User does not belong to any projects.

User Details

User Since
May 5 2018, 9:37 AM (118 w, 6 d)

Recent Activity

Today

nikic added a comment to D54749: Saturating float to int casts: Basics [1/n].

Finally, something worth mentioning is that the legalization implemented here is not compatible with trapping fptoi (at least one of the expansions isn't). I don't believe trapping fptoi's are actually legal per langref, but I've also seen people adjust x86 fptoi lowering to work with trapping fptoi at some point, so I'm a bit confused on what the state here is.

The fptosi instruction doesn't have side-effects. llvm.experimental.constrained.fptosi can raise floating-point exceptions. I'm not sure anyone has looked at actually trapping.

Fri, Aug 14, 12:29 PM · Restricted Project
nikic added a comment to D54749: Saturating float to int casts: Basics [1/n].

Thank you for picking this up. Some pointers from my side:

  • I would recommend against including GlobalISel support in the initial implementation. Unless trivial, SDAG and GlobalISel changes should never be made in the same patch, as the reviewers for these parts of the codebase are essentially disjoint.
  • You may want to replace the VT specifying the saturation width with a simple constant integer operand. This is the approach that the fixed-point ISD opcodes went with, and it should make legalization a bit simpler.
  • I originally restricted this patch to a minimum viable implementation, in the hope that it would make review easier and get this landed quickly. Given how things turned out, it might make sense to put the soft float and vector legalization (which are part of D54696) back into this patch, so that legalization support is complete and this can stand on its own.
  • For soft float legalization, I would switch from libcall legalization to expanding and recursively legalizing. Adding so many new compiler-rt functions is an unnecessary burden.
  • Finally, something worth mentioning is that the legalization implemented here is not compatible with trapping fptoi (at least one of the expansions isn't). I don't believe trapping fptoi's are actually legal per langref, but I've also seen people adjust x86 fptoi lowering to work with trapping fptoi at some point, so I'm a bit confused on what the state here is.
Fri, Aug 14, 10:23 AM · Restricted Project

Yesterday

nikic requested review of D85929: [InstSimplify] Fold min/max intrinsic based on icmp of operands.
Thu, Aug 13, 1:17 PM · Restricted Project
nikic committed rG524f591a395c: [InstSimplify] Add tests for assume with min/max intrinsic (NFC) (authored by nikic).
[InstSimplify] Add tests for assume with min/max intrinsic (NFC)
Thu, Aug 13, 1:10 PM
nikic added a comment to D84713: [DominatorTree] Simplify ChildrenGetter..

The regression here seems to be because operations on an empty GraphDiff don't optimize out. Not going through GraphDiff but using the same basic logic (https://github.com/llvm/llvm-project/commit/4c6a5de8131183ff88f52cc3dda67180e31501a1 -- going through a separate method seems to be necessary for NRVO) we get back at least part of it: https://llvm-compile-time-tracker.com/compare.php?from=38537307e502c1ac9a09e6f75f9208db1327a0bf&to=4c6a5de8131183ff88f52cc3dda67180e31501a1&stat=instructions

Thu, Aug 13, 12:31 AM · Restricted Project, Restricted Project

Wed, Aug 12

nikic closed D85765: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms.

This has landed in https://github.com/llvm/llvm-project/commit/a7a06ded8b0635268b5db218b3aca0b5b2bfb04a.

Wed, Aug 12, 1:31 PM · Restricted Project
nikic committed rGeba5f5f79823: [ValueTracking] Add abs intrinsics support to computeConstantRange() (authored by nikic).
[ValueTracking] Add abs intrinsics support to computeConstantRange()
Wed, Aug 12, 1:31 PM
nikic committed rG6446c1184001: [InstSimplify] Add additional abs intrinsic icmp tests (NFC) (authored by nikic).
[InstSimplify] Add additional abs intrinsic icmp tests (NFC)
Wed, Aug 12, 1:31 PM
nikic committed rG7397a019b80b: [InstSimplify] Extract abs intrinsic tests into separate file (NFC) (authored by nikic).
[InstSimplify] Extract abs intrinsic tests into separate file (NFC)
Wed, Aug 12, 1:31 PM
nikic committed rGe2040d38a1c7: [ValueTracking] Support min/max intrinsics in computeConstantRange() (authored by nikic).
[ValueTracking] Support min/max intrinsics in computeConstantRange()
Wed, Aug 12, 1:08 PM
nikic committed rGc1abd47aa16f: [InstSimplify] Add tests for icmp of min/max with constants (NFC) (authored by nikic).
[InstSimplify] Add tests for icmp of min/max with constants (NFC)
Wed, Aug 12, 1:08 PM

Tue, Aug 11

nikic accepted D85687: [Instcombine] Fix uses of undef (PR46940).

LGTM

Tue, Aug 11, 2:00 PM · Restricted Project
nikic added a comment to D85687: [Instcombine] Fix uses of undef (PR46940).

D85684 has landed now. After rebasing, you can also use SQ.getWithoutUndef() to reduce the boilerplate for creating a new SimplifyQuery.

Tue, Aug 11, 1:10 PM · Restricted Project
nikic accepted D85765: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms.

LGTM

Tue, Aug 11, 1:01 PM · Restricted Project
nikic committed rG06d567059e5a: [InstSimplify] Respect CanUseUndef in more places (authored by nikic).
[InstSimplify] Respect CanUseUndef in more places
Tue, Aug 11, 1:00 PM
nikic added inline comments to D85765: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms.
Tue, Aug 11, 11:37 AM · Restricted Project
nikic added a comment to D83360: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X.

D85684 has landed, so we can try reapplying this change.

Tue, Aug 11, 9:42 AM · Restricted Project, Restricted Project
nikic committed rGd110d4aaff31: [InstSimplify] Forbid undef folds in expandBinOp (authored by nikic).
[InstSimplify] Forbid undef folds in expandBinOp
Tue, Aug 11, 9:40 AM
nikic closed D85684: [InstSimplify] Forbid undef folds in expandBinOp.
Tue, Aug 11, 9:39 AM · Restricted Project
nikic accepted D85593: [InstCombine] ~(~X + Y) -> X - Y.

@aqjune Thank you! So my mistake here is that it's not valid to use "let undef = xxx" type reasoning to construct counter examples, one has to always consider a superposition of all possible values for undef at the same time.

Tue, Aug 11, 1:01 AM · Restricted Project
nikic added a comment to D85684: [InstSimplify] Forbid undef folds in expandBinOp.

Why is the test not part of this?

Maybe it is because an operation on undef is already folded before expandBinOp is reached. Is it right @nikic? I think having a working test here likely means we found another miscompilation regarding undef and distributivity law.
If select c, undef, x --> x is disabled later, it will leave the undef constant, making the test at select.ll valid.

Tue, Aug 11, 12:44 AM · Restricted Project

Mon, Aug 10

nikic added a comment to D85687: [Instcombine] Fix uses of undef (PR46940).

Oops, looks like we were working on this in parallel. I just submitted D85684 for the InstSimplify part of the problem.

Mon, Aug 10, 1:51 PM · Restricted Project
nikic committed rG566a66703f02: [InstSimplify] Add test for expand binop undef issue (NFC) (authored by nikic).
[InstSimplify] Add test for expand binop undef issue (NFC)
Mon, Aug 10, 1:40 PM
nikic added a reverting change for rG00f3579aea6e: Revert "[InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef ->…: D85684: [InstSimplify] Forbid undef folds in expandBinOp.
Mon, Aug 10, 1:23 PM
nikic requested review of D85684: [InstSimplify] Forbid undef folds in expandBinOp.
Mon, Aug 10, 1:23 PM · Restricted Project
nikic added inline comments to D85159: [ConstProp] Remove ConstantPropagation.
Mon, Aug 10, 12:18 PM · Restricted Project
nikic added inline comments to D84629: [LazyValueInfo] Let getEdgeValueLocal look into freeze instructions.
Mon, Aug 10, 12:07 PM · Restricted Project
nikic added inline comments to D85593: [InstCombine] ~(~X + Y) -> X - Y.
Mon, Aug 10, 12:00 PM · Restricted Project
nikic accepted D85647: [InstCombine] eliminate a pointer cast around insertelement.

Looks good to me. You already test the zext/trunc cases. I think this fold is also not problematic wrt https://bugs.llvm.org/show_bug.cgi?id=34548.

Mon, Aug 10, 11:56 AM · Restricted Project
nikic accepted D85658: [RDA] Fix DBG_VALUE issues.

This LGTM, with some thoughts on how this could be improved in a followup.

Mon, Aug 10, 10:03 AM · Restricted Project

Sun, Aug 9

nikic added inline comments to D85593: [InstCombine] ~(~X + Y) -> X - Y.
Sun, Aug 9, 7:50 AM · Restricted Project
nikic added inline comments to D85593: [InstCombine] ~(~X + Y) -> X - Y.
Sun, Aug 9, 7:08 AM · Restricted Project
nikic abandoned D65718: [LangRef] Document forward-progress requirement.

Abandoning this revision, as I expect this to get superseded by the LangRef patch for D85393 or a variation thereon, which will have to define both what constitutes forward progress and how the attributes either opts into or out of it.

Sun, Aug 9, 7:05 AM · Restricted Project

Sat, Aug 8

nikic requested review of D85583: [MemDep] Use BatchAA when computing pointer dependencies.
Sat, Aug 8, 9:37 AM · Restricted Project
nikic abandoned D64523: [SLPVectorizer] Fix getSpillCost() calculation.

This has since been addressed by D82444.

Sat, Aug 8, 5:47 AM · Restricted Project

Fri, Aug 7

nikic abandoned D54749: Saturating float to int casts: Basics [1/n].

I've tried to get this in for a long time, but I don't think there's enough interest in this functionality. Rust ended up doing the saturation itself, even though that produces code that is much worse than a custom lowered intrinsic. At some point you have to cut your losses :)

Fri, Aug 7, 2:41 PM · Restricted Project
nikic added inline comments to D85524: [Loads] Add canReplacePointersIfEqual helper..
Fri, Aug 7, 1:33 PM · Restricted Project
nikic accepted D85533: [InstCombine] Optimize select(freeze(icmp eq/ne x, y), x, y).

LGTM

Fri, Aug 7, 1:30 PM · Restricted Project
nikic added inline comments to D85524: [Loads] Add canReplacePointersIfEqual helper..
Fri, Aug 7, 12:28 PM · Restricted Project
nikic added inline comments to D85524: [Loads] Add canReplacePointersIfEqual helper..
Fri, Aug 7, 12:18 PM · Restricted Project
nikic added inline comments to D85533: [InstCombine] Optimize select(freeze(icmp eq/ne x, y), x, y).
Fri, Aug 7, 9:48 AM · Restricted Project
nikic added a comment to D81766: [VectorCombine] try to create vector loads from scalar loads.

LGTM with one minor @nikic Does this look OK now?

Fri, Aug 7, 9:39 AM · Restricted Project

Thu, Aug 6

nikic accepted D84948: [InstCombine] Fold freeze(undef) into a proper constant.

LGTM. There are various ways in which the value choice can be improved, but this looks like a good starting point.

Thu, Aug 6, 12:55 AM · Restricted Project

Wed, Aug 5

nikic added a comment to D84948: [InstCombine] Fold freeze(undef) into a proper constant.

Just as another possibility, we could simply always fold freeze undef to zeroinitializer in InstCombine (regardless of number of uses). This is not always the optimal fold, but usually a good one. At least at this point, I don't think freeze undef is expected to be common and it's more important to get rid of the freeze than find the best replacement.

Wed, Aug 5, 2:44 PM · Restricted Project
nikic added a comment to D84948: [InstCombine] Fold freeze(undef) into a proper constant.

Just as another possibility, we could simply always fold freeze undef to zeroinitializer in InstCombine (regardless of number of uses). This is not always the optimal fold, but usually a good one. At least at this point, I don't think freeze undef is expected to be common and it's more important to get rid of the freeze than find the best replacement.

Wed, Aug 5, 1:20 PM · Restricted Project
nikic accepted D84792: [InstSimplify/NewGVN] Add option to control the use of undef..

Ping. Should we go with this approach to start with, to unblock some patches and iterate on the details as follow-ups? It's not ideal for CanUseUndef to not cover all cases initially, but I am not sure what the alternative would be.

Wed, Aug 5, 12:31 PM · Restricted Project

Tue, Aug 4

nikic committed rG29fe3fe6155f: [InstSimplify] Peephole optimization for icmp (urem X, Y), X (authored by xldenis).
[InstSimplify] Peephole optimization for icmp (urem X, Y), X
Tue, Aug 4, 11:50 AM
nikic closed D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X.
Tue, Aug 4, 11:50 AM · Restricted Project
nikic committed rGb778b04b69d0: [InstSimplify] Add tests for icmp with urem divisor (NFC) (authored by xldenis).
[InstSimplify] Add tests for icmp with urem divisor (NFC)
Tue, Aug 4, 11:45 AM
nikic committed rG456497450482: [SCCP] Propagate inequalities (authored by nikic).
[SCCP] Propagate inequalities
Tue, Aug 4, 11:30 AM
nikic closed D83643: [SCCP] Propagate inequalities.
Tue, Aug 4, 11:30 AM · Restricted Project

Mon, Aug 3

nikic added a comment to D85046: [SCEV] If Start >= RHS, simplify (Start smin RHS) to RHS for trip counts (PR46924, PR46939).

For the record, this was a 1% compile-time regression on SPASS (https://llvm-compile-time-tracker.com/compare.php?from=7ba82a7320df82d07d3d5679bce89b14526b536c&to=ee1c12708a4519361729205168dedb2b61bc2638&stat=instructions). This seems to be caused due to a 2.3% increase in code size (https://llvm-compile-time-tracker.com/compare.php?from=7ba82a7320df82d07d3d5679bce89b14526b536c&to=ee1c12708a4519361729205168dedb2b61bc2638&stat=size-text), with some of the files getting 20-30% larger. Not particularly unexpected for this kind of change though.

Mon, Aug 3, 12:39 PM · Restricted Project
nikic added inline comments to D84763: DomTree: Make PostDomTree immune to block successors swap.
Mon, Aug 3, 4:10 AM · Restricted Project
nikic added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

Here's the numbers for this patch: https://llvm-compile-time-tracker.com/compare.php?from=4fdc4d892b988bb9f2e06c3440971d28d6361722&to=63b8e6e79174411d9340790fa5e4f67bc73620a0&stat=instructions There's a measurable impact, but doesn't seem particularly concerning (geomean 0.1% regression).

Mon, Aug 3, 1:10 AM · Restricted Project

Sun, Aug 2

nikic accepted D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X.

LGTM

Sun, Aug 2, 1:01 PM · Restricted Project
nikic added inline comments to D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X.
Sun, Aug 2, 7:32 AM · Restricted Project
nikic added inline comments to D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X.
Sun, Aug 2, 6:53 AM · Restricted Project
nikic committed rGa0addbb4ec8c: [InstSimplify] Reduce code duplication in icmp of binop folds (NFC) (authored by nikic).
[InstSimplify] Reduce code duplication in icmp of binop folds (NFC)
Sun, Aug 2, 6:47 AM

Sat, Aug 1

nikic committed rG25af353b0e74: [NewPM][LVI] Abandon LVI after CVP (authored by nikic).
[NewPM][LVI] Abandon LVI after CVP
Sat, Aug 1, 2:52 PM
nikic closed D84959: [NewPM][LVI] Abandon LVI after CVP.
Sat, Aug 1, 2:52 PM · Restricted Project, Restricted Project
nikic added inline comments to D81766: [VectorCombine] try to create vector loads from scalar loads.
Sat, Aug 1, 8:15 AM · Restricted Project
nikic accepted D85055: [InstCombine] Fold abs(-x) -> abs(x).

LG. I was wondering if we can use any of our more powerful negation machinery here, but I don't think so, because it would end up looping infinitely.

Sat, Aug 1, 1:09 AM · Restricted Project
nikic accepted D85053: [InstSimplify] Fold abs(abs(x)) -> abs(x).

LG. This has some overlap with D85043, which will already catch the cases where the inner abs has poison=true, but not those with poison=false, so this seems reasonable as an explicit fold. One could make an argument that this should live in InstCombine and try to preserve the outer poison flag, but this doesn't seem particularly important to me.

Sat, Aug 1, 1:01 AM · Restricted Project
nikic added a comment to D84959: [NewPM][LVI] Abandon LVI after CVP.

I don't really know what the tradeoff would be between using abandon() here and using InvalidateAnalysisPass. I went with this variant as @asbirlea indicated in https://reviews.llvm.org/D70376#2151283 that this would be preferred, as InvalidateAnalysisPass is really more intended for testing purposes.

Sat, Aug 1, 12:55 AM · Restricted Project, Restricted Project
nikic accepted D85043: [InstSimplify] simplify abs if operand is known non-negative.

Patch updated:
Pass in more info from the SimplifyQuery to ValueTracking.
Not sure what it takes to show the benefit, so no test diffs, but if there are suggestions, let me know.

Sat, Aug 1, 12:49 AM · Restricted Project

Fri, Jul 31

nikic added a comment to D85043: [InstSimplify] simplify abs if operand is known non-negative.

Yes, we should be fine compile-time wise. The icmp + select representation of abs implicitly did this as well, because we fold comparisons against zero more aggressively than others.

Fri, Jul 31, 2:33 PM · Restricted Project
nikic added inline comments to D82892: [NFC] Added comparison for all types in haveSameSpecialState() of Instruction.cpp.
Fri, Jul 31, 11:41 AM · Restricted Project
nikic added a comment to D82892: [NFC] Added comparison for all types in haveSameSpecialState() of Instruction.cpp.

Please take a look at how Instruction::clone() is implemented, using a protected cloneImpl() method on each instruction type. I would suggest to follow the same pattern, and make these type-specific methods protected (and drop the redundant doc comment on each one of them).

Fri, Jul 31, 11:28 AM · Restricted Project
nikic added inline comments to D84959: [NewPM][LVI] Abandon LVI after CVP.
Fri, Jul 31, 10:07 AM · Restricted Project, Restricted Project
nikic updated the diff for D84959: [NewPM][LVI] Abandon LVI after CVP.

Drop -lvi-no-abandon flag, update pipeline tests.

Fri, Jul 31, 10:06 AM · Restricted Project, Restricted Project
nikic added a comment to D84250: [InstSimplify] ExpandBinOp should fold an expression only when it's safe.

Assuming D84792 lands, would performing the two SimplifyBinOp queries for L and R with CanUseUndef=false solve this problem as well? I would prefer that if it works.

Fri, Jul 31, 9:11 AM · Restricted Project
nikic added inline comments to D84948: [InstCombine] Fold freeze(undef) into a proper constant.
Fri, Jul 31, 12:35 AM · Restricted Project

Thu, Jul 30

nikic committed rG9ebeac678855: [ConstantRange][CVP] Make use of abs poison flag (authored by nikic).
[ConstantRange][CVP] Make use of abs poison flag
Thu, Jul 30, 2:06 PM
nikic added inline comments to D84981: [NewPM] Don't print 'Invalidating all non-preserved analyses'.
Thu, Jul 30, 2:00 PM · Restricted Project
nikic committed rG94f8120cb9d3: [ConstantRange] Support abs with poison flag (authored by nikic).
[ConstantRange] Support abs with poison flag
Thu, Jul 30, 1:50 PM
nikic committed rGd8a98a9c351b: [ConstantRange][CVP] Compute min/max/abs intrinsic ranges (authored by nikic).
[ConstantRange][CVP] Compute min/max/abs intrinsic ranges
Thu, Jul 30, 1:22 PM
nikic committed rG95d1e668ed50: [CVP] Add tests for min/max/abs intrinsic comparisons (NFC) (authored by nikic).
[CVP] Add tests for min/max/abs intrinsic comparisons (NFC)
Thu, Jul 30, 1:17 PM
nikic committed rG4c16eafe12a5: [SCCP] Remove dead switch cases based on range information (authored by nikic).
[SCCP] Remove dead switch cases based on range information
Thu, Jul 30, 12:21 PM
nikic closed D84270: [SCCP] Remove dead switch cases based on range information.
Thu, Jul 30, 12:21 PM · Restricted Project
nikic added a comment to D84959: [NewPM][LVI] Abandon LVI after CVP.

Here is how updating one of the tests would look like: https://gist.github.com/nikic/577dead281f1aee10b492c3fc7130f5b

Thu, Jul 30, 12:02 PM · Restricted Project, Restricted Project
nikic requested review of D84959: [NewPM][LVI] Abandon LVI after CVP.
Thu, Jul 30, 11:01 AM · Restricted Project, Restricted Project
nikic added a comment to D84948: [InstCombine] Fold freeze(undef) into a proper constant.

Do these show up in practice?

Thu, Jul 30, 10:03 AM · Restricted Project

Wed, Jul 29

nikic updated the diff for D84270: [SCCP] Remove dead switch cases based on range information.

Set AllowUndef=false, switch tests to use !range instead of comparisons.

Wed, Jul 29, 1:31 PM · Restricted Project
nikic committed rG897bdca4b81d: [ConstantRange] Add API for intrinsics (NFC) (authored by nikic).
[ConstantRange] Add API for intrinsics (NFC)
Wed, Jul 29, 1:17 PM
nikic closed D84587: [ConstantRange] Add API for intrinsics (NFC).
Wed, Jul 29, 1:16 PM · Restricted Project
nikic added a comment to D84821: [InstCombine] Don't transfer BitCastInst at InstCombine pass when the user of BitCast is lifetime marker.

I don't think this is the right approach to the problem. Can you give some more information on which places in LLVM assume that only bitcasts feed into lifetime intrinsics?

Wed, Jul 29, 1:09 PM · Restricted Project
nikic added a comment to D84609: [MemDepAnalysis] Cut-off threshold reshuffling .

I wasn't really asking about NewGVN story, i know it's stagnant somewhat.
I was only asking, would it be better to instead look into porting
GVN::processNonLocalLoad() to be MemorySSA-driven.

If we're building two analyses (MSSA & MemDepAnalysis) instead of one, I expect we'll see a spike in compile-time. Additionally, MemDepAnalysis is a piece of technical debt that would be nice to replace altogether.
IMO it makes sense to make the transition for the whole pass, or for the pipeline of 3 passes in one go.

Wed, Jul 29, 9:51 AM · Restricted Project
nikic added a comment to D84108: [SimplifyCFG][LoopRotate] SimplifyCFG: disable common instruction hoisting by default, enable late in pipeline.

Fine by me, but not sure if @nikic has any questions.

@nikic ?

Wed, Jul 29, 9:33 AM · Restricted Project
nikic added a comment to D84664: [InstCombine] Fold shift-select if all the operands are constant.

Okay, after looking at this again I think you're on the right track here.

Wed, Jul 29, 9:12 AM · Restricted Project
nikic added a comment to D84792: [InstSimplify/NewGVN] Add option to control the use of undef..

Is the goal here that it's legal to replace the output value of SimplifyInstruction with the input value, in addition to the normal replacement of the input value with the output value? Or do we specifically care about literal UndefValue constants somehow, as opposed to values which are undef? If we had a PoisonValue constant, would we also need to exclude it?

Wed, Jul 29, 8:55 AM · Restricted Project
nikic added a comment to D84713: [DominatorTree] Simplify ChildrenGetter..

This change had a significant negative compile-time impact: https://llvm-compile-time-tracker.com/compare.php?from=0b161def6cacff1a63d3cf1a1efe95b550814d7a&to=e22de4e46d1dd1aacc3a7060d24bcbe89908ba6c&stat=instructions

Wed, Jul 29, 4:04 AM · Restricted Project, Restricted Project

Tue, Jul 28

nikic added a comment to D84655: [InstSimplify] fold min/max intrinsics using icmp simplification.

Yes, this reminds me of D77868, so I'm worried that we can't trust SimplifyICmpInst without a stronger undef check. Given that, I'd rather abandon this approach. I think we can put in a handful of direct min/max simplifications and be confident that we have good optimization and safety. Ie, back to the approach started with rG0481e1a.

I think this case is a bit different from D77868: min/max can be expressed as a composition of icmp with select.

v = smax(a, b)
<=>
c = icmp sgt a, b
v = select c, a, b
Tue, Jul 28, 1:15 PM · Restricted Project
nikic accepted D84762: [InstSimplify] allow undefs in icmp with vector constant folds.

LG as well.

Tue, Jul 28, 10:23 AM · Restricted Project

Mon, Jul 27

nikic added inline comments to D84629: [LazyValueInfo] Let getEdgeValueLocal look into freeze instructions.
Mon, Jul 27, 12:58 PM · Restricted Project
nikic added a comment to D84664: [InstCombine] Fold shift-select if all the operands are constant.

It looks like currently we only transform this for the single-use case, but not the multi-use case: https://godbolt.org/z/9oYeEq

Mon, Jul 27, 12:16 PM · Restricted Project
nikic added inline comments to D84629: [LazyValueInfo] Let getEdgeValueLocal look into freeze instructions.
Mon, Jul 27, 12:09 PM · Restricted Project
nikic updated subscribers of D84655: [InstSimplify] fold min/max intrinsics using icmp simplification.

But (if my undef reasoning is correct), this is not as easy as always returning the existing operand. In the case of undefs, we need to clamp to the limit constant. This is similar to what we do with the saturating math intrinsics.

Mon, Jul 27, 12:03 PM · Restricted Project
nikic added inline comments to D84270: [SCCP] Remove dead switch cases based on range information.
Mon, Jul 27, 3:26 AM · Restricted Project
nikic accepted D84601: [InstCombine] Fold freeze into phi if one operand is not undef.

As a possible followup: This code could be generalized a bit by using "constant && !constexpr" for non-freeze and "guaranteed-not-undef" (without any constant checks) for freeze, with some appropriate renames. This would basically change the transform from splitting into "constant" and "non-constant" inputs, into "foldable" and "non-foldable" inputs (where "foldable = constant" for most cases).

Mon, Jul 27, 12:35 AM · Restricted Project

Sun, Jul 26

nikic added inline comments to D84601: [InstCombine] Fold freeze into phi if one operand is not undef.
Sun, Jul 26, 2:37 PM · Restricted Project