Page MenuHomePhabricator
Feed Advanced Search

Wed, Jul 21

kuhar committed rG3c3165cfa0a4: [ADT] Add initializer_list constructor to SmallDenseMap (authored by kuhar).
[ADT] Add initializer_list constructor to SmallDenseMap
Wed, Jul 21, 6:33 AM
kuhar closed D106363: [ADT] Add initializer_list constructor to SmallDenseMap.
Wed, Jul 21, 6:32 AM · Restricted Project

Tue, Jul 20

kuhar updated the diff for D106363: [ADT] Add initializer_list constructor to SmallDenseMap.

Use the assignment syntax in the test, per David's suggestion.

Tue, Jul 20, 11:57 AM · Restricted Project
kuhar requested review of D106363: [ADT] Add initializer_list constructor to SmallDenseMap.
Tue, Jul 20, 7:27 AM · Restricted Project

Jun 17 2021

kuhar accepted D90352: Introduce a Bazel build configuration.

Given the nature of this, I think there's not much approval required beyond the proposal approval - beyond that, it's basically yours (& anyone else who stands up to say they care deeply about bazel build files) to do with as you please.

Jun 17 2021, 2:03 PM · Restricted Project

Jun 16 2021

kuhar added inline comments to D90352: Introduce a Bazel build configuration.
Jun 16 2021, 1:03 PM · Restricted Project

Apr 28 2021

kuhar added inline comments to D101471: [clang-tidy] Add proper emplace checks to modernize-use-emplace.
Apr 28 2021, 6:12 PM · Restricted Project, Restricted Project

Mar 29 2021

kuhar added a comment to D91327: [NewPM] Redesign of PreserveCFG Checker.

Just two nits from me. I think it looks fine, but I'm not familiar with the new pass manager and don't feel confident enough to approve it.

Mar 29 2021, 7:32 AM · Restricted Project, Restricted Project

Jan 27 2021

kuhar accepted D94827: [SimplifyCFG] If provided, preserve Dominator Tree.

Choo choo

Jan 27 2021, 12:13 PM · Restricted Project, Restricted Project, Restricted Project

Jan 15 2021

kuhar added a comment to D94827: [SimplifyCFG] If provided, preserve Dominator Tree.

Wow, this is fantastic. When I first started working on the domtree updater back in 2017, SimplifyGFG seemed like one of the most difficult passes to handle, and I wasn't sure if we ever get there. Very impressive work, @lebedev.ri!

Jan 15 2021, 2:58 PM · Restricted Project, Restricted Project, Restricted Project

Dec 21 2020

kuhar accepted D93371: [DominatorTree] Add support for mixed pre/post CFG views..

LGTM

Dec 21 2020, 7:11 PM · Restricted Project
kuhar added inline comments to D93371: [DominatorTree] Add support for mixed pre/post CFG views..
Dec 21 2020, 10:13 AM · Restricted Project

Nov 23 2020

kuhar added a comment to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.

I see the deep API problem here now. Current dominates(Value *, Instruction *) should not be called like that (at least because it returns false for dominates(X, X)). It has a different semantics, and should be called something like "canBeUserOf".

The clear definition of dominance between two instructions is also something fishy. Specifically, it is fishy for Phi nodes from the same block (there is no precedence between them). Maybe the best name to express what we need in this patch would be comesBefore.

It looks like a vast rework of whole DomTree API. I'm OK doing that, but do not want to have my patches waiting for this API rework (they honestly don't need). Let's unblock this branch first and then think how to name it better.

Nov 23 2020, 8:32 AM · Restricted Project

Nov 22 2020

kuhar added a comment to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.

You can find the planned user in dependencies stack: https://reviews.llvm.org/D90456

I need the common dom to find the latest context where we can prove predicate so that it's also true for all given instructions.

Nov 22 2020, 10:57 PM · Restricted Project
kuhar added inline comments to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.
Nov 22 2020, 10:44 PM · Restricted Project
kuhar added a comment to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.

I was considering that, but don't really see how it's useful. The existing code makes N iterations, for which of them it either calls comesBefore or findNCD (findNCD will be called as many times as many different blocks there is - 1).

In the proposed solution, I'll need to:

  • FIll the set of blocks (because API of findNCD needs blocks)
  • Call multi-arg findNCD (which will call two-arg NCD same amount of times)
  • make comesBefore queries for all instructions in topmost block.

Effectively it's always the same number of findNCD queries, overhead on set creation and potentially less number of comesBefore queries (in my solution we do it in all blocks). So overhead on set filling doesn't seem worth saving some number of cheap comesBefore queries in general case. So I just don't see why this alternative solution is better.

Nov 22 2020, 10:19 PM · Restricted Project
kuhar added inline comments to D91327: [NewPM] Redesign of PreserveCFG Checker.
Nov 22 2020, 10:09 PM · Restricted Project, Restricted Project

Nov 20 2020

kuhar added a comment to D91327: [NewPM] Redesign of PreserveCFG Checker.

Looks fine to me, but I'm not confident enough to give an approval.

Nov 20 2020, 10:23 AM · Restricted Project, Restricted Project
kuhar requested changes to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.
Nov 20 2020, 9:02 AM · Restricted Project
kuhar added a comment to D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions.

As an alternative implementation, have you considered teaching DomTree::findNCD to work with multiple basic blocks first, and then using this to implement the multi-instruction findNCD?
The algorithm would be like this: create a vector VBB of BB of all instructions, find its NCD, case split on the NCD and VBB being the same block or not.

Nov 20 2020, 8:59 AM · Restricted Project

Nov 17 2020

kuhar added a comment to D91327: [NewPM] Redesign of PreserveCFG Checker.

Found some cosmetics, but I'm not familiar enough with the NPM to do a full review.

Nov 17 2020, 3:32 PM · Restricted Project, Restricted Project
kuhar accepted D91324: [NewPM] Disable PreserveCFGChecker and add regression unit tests.

LGTM

Nov 17 2020, 3:24 PM · Restricted Project

Oct 20 2020

kuhar accepted D89632: [DomTree] Accept Value as Def (NFC).

Thanks for updating the comments.

Oct 20 2020, 1:48 PM · Restricted Project

Oct 19 2020

kuhar accepted D89632: [DomTree] Accept Value as Def (NFC).

OK, thanks for the clarification. Can you update the function-level comment with an explanation like this?

Oct 19 2020, 12:57 PM · Restricted Project
kuhar added a comment to D89632: [DomTree] Accept Value as Def (NFC).

Interesting idea.

Oct 19 2020, 12:12 PM · Restricted Project

Oct 4 2020

kuhar accepted D88758: [DomTree] findNearestCommonDominator: assert the nodes are in tree.

OK, thanks for looking into this.

Oct 4 2020, 2:19 PM · Restricted Project
kuhar requested changes to D88758: [DomTree] findNearestCommonDominator: assert the nodes are in tree.

One remaining thing: the function documentation needs to be updated:

Oct 4 2020, 2:02 PM · Restricted Project
kuhar accepted D88758: [DomTree] findNearestCommonDominator: assert the nodes are in tree.
Oct 4 2020, 1:56 PM · Restricted Project

Oct 3 2020

kuhar added a comment to D88758: [DomTree] findNearestCommonDominator: assert the nodes are in tree.

Does this break any existing code?

Oct 3 2020, 3:52 PM · Restricted Project

Sep 8 2020

kuhar accepted D87319: [DomTree] Use SmallVector<DomTreeNodeBase *, 4> instead of std::vector..

Thanks for the numbers. LGTM.

Sep 8 2020, 12:39 PM · Restricted Project
kuhar accepted D81558: [NewPM] Introduce PreserveCFG check.

Thanks for the table, this looks good to me now, modulo the two remaining nits. I'd be more comfortable if somebody familiar with the new pass manager reviewed this too.

Sep 8 2020, 7:05 AM · Restricted Project

Sep 3 2020

kuhar added inline comments to D81558: [NewPM] Introduce PreserveCFG check.
Sep 3 2020, 9:43 PM · Restricted Project

Sep 1 2020

kuhar added inline comments to D81558: [NewPM] Introduce PreserveCFG check.
Sep 1 2020, 11:19 AM · Restricted Project
kuhar added inline comments to D81558: [NewPM] Introduce PreserveCFG check.
Sep 1 2020, 10:01 AM · Restricted Project
kuhar added a comment to D81558: [NewPM] Introduce PreserveCFG check.

This looks very useful. Does it currently report any errors when enabled?

Sep 1 2020, 9:02 AM · Restricted Project

Aug 21 2020

kuhar accepted D85472: [DomTree] Extend update API to allow a post CFG view..
Aug 21 2020, 2:29 PM · Restricted Project

Aug 19 2020

kuhar added a comment to D83088: Introduce CfgTraits abstraction.

Hi Nicoali,

Aug 19 2020, 2:21 PM · Restricted Project, Restricted Project, Restricted Project

Aug 17 2020

kuhar committed rGeed6476a8744: Reset PAL metadata when AMDGPU traget stream finishes (authored by s-perron).
Reset PAL metadata when AMDGPU traget stream finishes
Aug 17 2020, 8:00 AM
kuhar closed D85667: Reset PAL metadata when AMDGPU traget stream finishes.
Aug 17 2020, 8:00 AM · Restricted Project

Aug 11 2020

kuhar added a comment to D85472: [DomTree] Extend update API to allow a post CFG view..

This makes sense to me. I think the only missing piece is some documentation which also explains how to interpret when PostView is missing (PostView == nullptr ===> Current CFG is the implicit PostView?)

Aug 11 2020, 9:24 AM · Restricted Project

Aug 5 2020

kuhar added inline comments to D81558: [NewPM] Introduce PreserveCFG check.
Aug 5 2020, 7:59 AM · Restricted Project

Aug 4 2020

kuhar requested changes to D81558: [NewPM] Introduce PreserveCFG check.

I think this deserves some extra documentation that explains what it means to preserve CFG in plain English. For example, should we also care about preserving the number of return blocks?

Aug 4 2020, 11:40 AM · Restricted Project
kuhar accepted D84763: DomTree: Make PostDomTree immune to block successors swap.
Aug 4 2020, 11:30 AM · Restricted Project

Jul 31 2020

kuhar added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

The code looks fine to me. Have you checked if compilation times are affected by this patch?

Jul 31 2020, 9:02 AM · Restricted Project

Jul 29 2020

kuhar resigned from D84279: AMDGPU/GlobalISel: Handle llvm.amdgcn.reloc.constant.

The patch looks fine to me, but I'm not familiar enough with the backend and GlobalIsel to review it.

Jul 29 2020, 10:02 AM · Restricted Project

Jul 28 2020

kuhar added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

One more thing: should this be backported for the upcoming 11.0 release?

Jul 28 2020, 11:01 PM · Restricted Project
kuhar added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

Taking a few steps back, I'd love to see a cfg preservation check like D81558 ...

I'm about to update the patches.

While this makes root finding insensitive to successors' order, I think it still may be possible to run into tree instability by changing the order of tree children (also plain domtree),...

I feel I do not understand. Any example?

and in turn changing DFS numbers used by other analyses. ...

I agree that DFS numbers are changed by successors swap, but can we make an exclusion for DFS numbers? If not, then this patch is useless because successors swap change CFG by definition (DFS numbers will be changes if we recalculate them).

AFAIK tree updates would still be based on some Cfg/Graph traits, which may give you unstable order.

As I see successors swap cannot be encoded for DomTreeUpdater. So this kind of change are not tracked.

Jul 28 2020, 11:00 PM · Restricted Project
kuhar accepted D84713: [DominatorTree] Simplify ChildrenGetter..
Jul 28 2020, 3:34 PM · Restricted Project, Restricted Project
kuhar added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

I think this is a good direction.

Jul 28 2020, 11:58 AM · Restricted Project
kuhar added a comment to D84763: DomTree: Make PostDomTree immune to block successors swap.

Given that you want to fix InstCombine not to swap successors and move this to SimplifyCFG, does this patch improve anything in the current pass pipeline?

I don't believe that is the correct fix, because it literally says "nope, there is no way to update PDT after swapping successors other than full domtree recomputation", that is why i'm pushing for fixing PDT.

Jul 28 2020, 11:48 AM · Restricted Project
kuhar added a comment to D84493: [InstCombine] Disable branch predicate canonicalization.

<..> you have to chose some arbitrary way of selecting a fake-entry node from nodes in an scc. Right now this order is whatever children or inverse_children return, but could be based on the order of blocks in a function instead.

Ok. Let us try now. But why did not they do it a few years ago then?

Jul 28 2020, 11:43 AM · Restricted Project
kuhar added a comment to D84492: [SimplifyCFG] Enable branch predicate canonicalization by default.

Would it make sense to enable the canonicalization in SimplifyCFG and disable the one in InstCombine as a single patch?

Jul 28 2020, 11:38 AM · Restricted Project
kuhar added inline comments to D84491: [SimplifyCFG] Canonicalize branch predicates.
Jul 28 2020, 11:36 AM · Restricted Project
kuhar requested changes to D84763: DomTree: Make PostDomTree immune to block successors swap.

Thanks for pushing on this.

Jul 28 2020, 11:21 AM · Restricted Project
kuhar added reviewers for D84763: DomTree: Make PostDomTree immune to block successors swap: kuhar, asbirlea.
Jul 28 2020, 10:35 AM · Restricted Project
kuhar accepted D83093: DomTree: Define GraphTraits for GenericDomTreeBase.
Jul 28 2020, 7:51 AM · Restricted Project

Jul 27 2020

kuhar accepted D83092: DomTree: Add climbLhsUntilSiblings helper.
Jul 27 2020, 5:33 PM · Restricted Project
kuhar accepted D84713: [DominatorTree] Simplify ChildrenGetter..

One tiny nit: the function name ChildrenGet sounds kind of backwards to me, but it seems like the other direction is already taken.

Jul 27 2020, 5:28 PM · Restricted Project, Restricted Project

Jul 8 2020

kuhar accepted D83089: DomTree: Extract (mostly) read-only logic into type-erased base classes.

Thanks for checking this. I dug up some old whole-program bitcode and uploaded it here in case it helps with future code reviews: https://drive.google.com/drive/folders/1VJpym19cW-8BVgdtl2MsD3zB4CoEQ93O?usp=sharing

Jul 8 2020, 12:00 PM · Restricted Project
kuhar added a comment to D83087: DomTree: remove explicit use of DomTreeNodeBase::iterator.

modulo accidental formatting changes.

I'm not aware of any. Some line breaks changed because "const_iterator" is longer than "iterator".

Jul 8 2020, 8:40 AM · Restricted Project, Restricted Project, Restricted Project

Jul 6 2020

kuhar accepted D83087: DomTree: remove explicit use of DomTreeNodeBase::iterator.

LGTM modulo accidental formatting changes.

Jul 6 2020, 8:11 PM · Restricted Project, Restricted Project, Restricted Project
kuhar accepted D83090: DomTree: Add TreeNode type alias.

LGTM

Jul 6 2020, 7:55 PM · Restricted Project
kuhar requested changes to D83092: DomTree: Add climbLhsUntilSiblings helper.
Jul 6 2020, 7:52 PM · Restricted Project
kuhar added a comment to D83089: DomTree: Extract (mostly) read-only logic into type-erased base classes.

Overall, this seems like a good idea to me. The amount of templated code started growing out of hand some time ago, to the point where it's really hard to make logically changes, especially in the generic updater code.

Jul 6 2020, 7:43 PM · Restricted Project

Jul 4 2020

kuhar added a comment to D83160: [InstCombine] Lower infinite combine loop detection thresholds.

Overall, I think this is a good direction, but I'd like to understand better why InstCombine needs more than a few iterations and how 'fix' these cases without bailing out after a fixed number of iterations.
I'd be interested to find out if we can make an IR pattern generator that forces InstCombine to run N iterations. Are there any algorithmic guarantees of the current implementation which we could use to show that InstCombine doesn't go into an infinite loop?

Jul 4 2020, 10:46 AM · Restricted Project

Jul 2 2020

kuhar added a reviewer for D83088: Introduce CfgTraits abstraction: asbirlea.
Jul 2 2020, 7:25 PM · Restricted Project, Restricted Project, Restricted Project
kuhar added reviewers for D83089: DomTree: Extract (mostly) read-only logic into type-erased base classes: asbirlea, brzycki, kuhar.
Jul 2 2020, 7:25 PM · Restricted Project
kuhar added a reviewer for D83088: Introduce CfgTraits abstraction: brzycki.
Jul 2 2020, 7:25 PM · Restricted Project, Restricted Project, Restricted Project

Jun 11 2020

kuhar added a comment to D81089: Mark InstCombine as not preserving CFG.

If we define that changing successor order constitutes a CFG change, then these optimizations need to be dropped from InstCombine, and moved into SimplifyCFG.

As said before, InstCombine is supposed to be CFG-preserving -- if it isn't because the definition of what "CFG-preserving" means was unclear, then we need to fix InstCombine to be in line with we new definition.

As the pipeline diffs show, not preserving CFG has a very real cost (five new domtree calculations at least). We should try to avoid that :)

Jun 11 2020, 11:00 AM · Restricted Project
kuhar added a comment to D81089: Mark InstCombine as not preserving CFG.

Even if we agree the way the PostDominatorTree computes roots in cases involving infinite loops shouldn't depend on the ordering of successors, I'm not sure it's correct to say that instcombine "preserves the CFG". Even for the regular DominatorTree, I think reordering the successors invalidates DFS numbering (in the sense that it changes the result of getDFSNumIn()).

You can always preserve domtrees by marking dfsnumbers as invalid.

Jun 11 2020, 11:00 AM · Restricted Project

Jun 3 2020

kuhar added a comment to D81089: Mark InstCombine as not preserving CFG.

As a quick fix, maybe we could try to detect changes in reverse-unreachable code and update postdominators when that's detected? Not sure how much overhead that would be; InstCombine is already very expensive w.r.t. compilation times.

Jun 3 2020, 3:29 PM · Restricted Project

May 12 2020

kuhar accepted D78881: [FlattenCFG] Fix `MergeIfRegion` in case then-path is empty.

Rename Invert2 variable to InvertCond2.
Hope it makes more sense.

May 12 2020, 8:34 AM · Restricted Project

May 11 2020

kuhar accepted D78881: [FlattenCFG] Fix `MergeIfRegion` in case then-path is empty.

I followed the new tests and the patch seems fine to me, but I'd rather someone else took a look too.

May 11 2020, 6:56 AM · Restricted Project

Apr 18 2020

kuhar accepted D77967: [Dominators] Facilitate updates to MachinePostDominatorTree.

While this is fine, I'm I don't understand how splitting critical edges will interact with domtree updates when you call getBase in MachineDominators.h. But we can discuss that in another patch.

Apr 18 2020, 3:38 PM · Restricted Project

Apr 12 2020

kuhar added a comment to D77967: [Dominators] Facilitate updates to MachinePostDominatorTree.

Could you add some basic unit tests and a separate set of unit tests where critical edges get split?

Apr 12 2020, 12:16 PM · Restricted Project

Apr 8 2020

kuhar accepted D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff..

Looks good to me overall. I don't want to block it over the cosmetic issues like allocating the empty GD object.

Apr 8 2020, 7:57 PM · Restricted Project, Restricted Project

Apr 5 2020

kuhar added a comment to D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff..

Address comments.

Apr 5 2020, 7:45 PM · Restricted Project, Restricted Project
kuhar added inline comments to D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff..
Apr 5 2020, 7:45 PM · Restricted Project, Restricted Project

Apr 2 2020

kuhar added inline comments to D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff..
Apr 2 2020, 8:04 PM · Restricted Project, Restricted Project
kuhar added inline comments to D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff..
Apr 2 2020, 8:04 PM · Restricted Project, Restricted Project

Mar 31 2020

kuhar accepted D77167: [GraphDiff] Extend GraphDiff to track a list of updates..

LGTM

Mar 31 2020, 2:17 PM · Restricted Project

Mar 30 2020

kuhar committed rG77ce2e21a877: [AMDGPU] Add Relocation Constant Support (authored by kuhar).
[AMDGPU] Add Relocation Constant Support
Mar 30 2020, 10:51 AM
kuhar closed D76440: [AMDGPU] Add Relocation Constant Support.
Mar 30 2020, 10:51 AM · Restricted Project

Mar 25 2020

kuhar accepted D76813: Remove overly verbose debug from GenericDomTreeConstruction.
Mar 25 2020, 5:53 PM · Restricted Project

Mar 18 2020

kuhar committed rG1e4ee0bfc529: [Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC. (authored by kuhar).
[Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC.
Mar 18 2020, 11:25 AM
kuhar closed D76340: [Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC..
Mar 18 2020, 11:25 AM · Restricted Project
kuhar added inline comments to D76340: [Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC..
Mar 18 2020, 11:24 AM · Restricted Project

Mar 17 2020

kuhar created D76340: [Dominators] Fixup comments in GenericDominatorTreeConstruction. NFC..
Mar 17 2020, 7:59 PM · Restricted Project

Feb 29 2020

kuhar added inline comments to D74931: [Dominators] Use Instruction::comesBefore for block-local queries, NFC.
Feb 29 2020, 2:47 PM · Restricted Project

Feb 20 2020

kuhar added inline comments to D74931: [Dominators] Use Instruction::comesBefore for block-local queries, NFC.
Feb 20 2020, 7:46 PM · Restricted Project
kuhar added inline comments to D74931: [Dominators] Use Instruction::comesBefore for block-local queries, NFC.
Feb 20 2020, 3:25 PM · Restricted Project
kuhar added inline comments to D74931: [Dominators] Use Instruction::comesBefore for block-local queries, NFC.
Feb 20 2020, 2:39 PM · Restricted Project
kuhar accepted D74931: [Dominators] Use Instruction::comesBefore for block-local queries, NFC.

LGTM

Feb 20 2020, 2:30 PM · Restricted Project

Dec 20 2019

kuhar committed rGc431c407ebcb: [InstCombine] Improve infinite loop detection (authored by kuhar).
[InstCombine] Improve infinite loop detection
Dec 20 2019, 1:27 PM
kuhar closed D71673: [InstCombine] Improve infinite loop detection.
Dec 20 2019, 1:26 PM · Restricted Project

Dec 18 2019

kuhar created D71673: [InstCombine] Improve infinite loop detection.
Dec 18 2019, 1:03 PM · Restricted Project
kuhar committed rG3d29c41ad59e: [InstCombine] Insert instructions before adding them to worklist (authored by kuhar).
[InstCombine] Insert instructions before adding them to worklist
Dec 18 2019, 12:05 PM
kuhar closed D71093: [InstCombine] Insert instructions before adding them to worklist.
Dec 18 2019, 12:05 PM · Restricted Project
kuhar committed rG406b6019cd2b: [InstCombine] Allow to limit the max number of iterations (authored by kuhar).
[InstCombine] Allow to limit the max number of iterations
Dec 18 2019, 10:56 AM
kuhar closed D71145: [InstCombine] Allow to limit the max number of iterations.
Dec 18 2019, 10:56 AM · Restricted Project