Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

mgudim (Mikhail Gudim)
User

Projects

User does not belong to any projects.

User Details

User Since
Oct 3 2019, 10:50 AM (208 w, 5 d)

Recent Activity

Aug 1 2023

mgudim committed rG0fb3ebb2fcd7: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations. (authored by mgudim).
[RISCV] Generalize 'tryFoldSelectIntOp` to other operations.
Aug 1 2023, 8:29 AM · Restricted Project, Restricted Project
mgudim closed D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..
Aug 1 2023, 8:29 AM · Restricted Project, Restricted Project
mgudim updated the diff for D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..

clang-format

Aug 1 2023, 6:53 AM · Restricted Project, Restricted Project

Jul 31 2023

mgudim updated the diff for D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..

updated condbinops.ll

Jul 31 2023, 2:43 PM · Restricted Project, Restricted Project

Jul 28 2023

mgudim committed rGcb15e657b5ef: [RISCV] A test for conditional binary ops. (authored by mgudim).
[RISCV] A test for conditional binary ops.
Jul 28 2023, 8:09 AM · Restricted Project, Restricted Project
mgudim closed D155481: [RISCV] A test for conditional binary ops..
Jul 28 2023, 8:08 AM · Restricted Project, Restricted Project

Jul 25 2023

mgudim added a comment to D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..

Where did the tests go?

Jul 25 2023, 1:14 PM · Restricted Project, Restricted Project
mgudim updated the diff for D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..

Addressed comments
Updated failing tests

Jul 25 2023, 1:12 PM · Restricted Project, Restricted Project

Jul 18 2023

mgudim added a comment to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..

@asb

Did you have thoughts on those?

Jul 18 2023, 8:47 AM · Restricted Project, Restricted Project

Jul 17 2023

mgudim updated the summary of D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..
Jul 17 2023, 10:13 AM · Restricted Project, Restricted Project
mgudim updated the diff for D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..

removed FADD and FSUB
removed the test, it will be commited in a separate patch

Jul 17 2023, 10:12 AM · Restricted Project, Restricted Project
mgudim updated the diff for D155481: [RISCV] A test for conditional binary ops..

added 32-bit versions
removed fadd and fsub because 0.0f is not an identity for these operations.

Jul 17 2023, 9:55 AM · Restricted Project, Restricted Project
mgudim updated the summary of D155481: [RISCV] A test for conditional binary ops..
Jul 17 2023, 9:06 AM · Restricted Project, Restricted Project
mgudim requested review of D155481: [RISCV] A test for conditional binary ops..
Jul 17 2023, 9:04 AM · Restricted Project, Restricted Project

Jul 14 2023

mgudim added inline comments to D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..
Jul 14 2023, 3:36 PM · Restricted Project, Restricted Project
mgudim requested review of D155344: [RISCV] Generalize 'tryFoldSelectIntOp` to other operations..
Jul 14 2023, 3:34 PM · Restricted Project, Restricted Project
mgudim added a comment to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..

LGTM, but it seems weird to me that we have to re-implement such basic optimisations instead of generic code doing this. @craig.topper @asb I know I asked this is the call, but I still don't understand why we emit target-specific node for SELECT so early?

There isn’t a generic combine for this on select after type legalization. It depends on getBooleanContents to know the value for true. So I think it only exists for i1.

Jul 14 2023, 2:55 PM · Restricted Project, Restricted Project
mgudim added a comment to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..

LGTM, but it seems weird to me that we have to re-implement such basic optimisations instead of generic code doing this. @craig.topper @asb I know I asked this is the call, but I still don't understand why we emit target-specific node for SELECT so early?

Jul 14 2023, 2:10 PM · Restricted Project, Restricted Project
mgudim added inline comments to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..
Jul 14 2023, 1:58 PM · Restricted Project, Restricted Project
mgudim added inline comments to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..
Jul 14 2023, 1:50 PM · Restricted Project, Restricted Project
mgudim added inline comments to D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1..
Jul 14 2023, 1:38 PM · Restricted Project, Restricted Project
mgudim added a comment to D152147: [RISCV] Fold binary op into select if profitable..

I have accidentally commited this in "Needs Review" state. What should I do?

Jul 14 2023, 12:44 PM · Restricted Project, Restricted Project
mgudim committed rGc158ddd99eaf: Reapply [RISCV] Fold binary op into select if profitable. (authored by mgudim).
Reapply [RISCV] Fold binary op into select if profitable.
Jul 14 2023, 12:32 PM · Restricted Project, Restricted Project
mgudim closed D152147: [RISCV] Fold binary op into select if profitable..
Jul 14 2023, 12:31 PM · Restricted Project, Restricted Project
mgudim added inline comments to D155288: [RISCV] Add a new select combine for when the condition is a setcc that will be inverted.
Jul 14 2023, 11:12 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

rebased on current main.

Jul 14 2023, 10:39 AM · Restricted Project, Restricted Project
mgudim added inline comments to D155288: [RISCV] Add a new select combine for when the condition is a setcc that will be inverted.
Jul 14 2023, 10:32 AM · Restricted Project, Restricted Project
mgudim added inline comments to D152147: [RISCV] Fold binary op into select if profitable..
Jul 14 2023, 9:59 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

addressed comments:
(1) Moved definitions of ConstSelOp and ConstSelOpNode lower.
(2) Added check DAG.isSafeToSpeculativelyExecute(...) to check if commuting select and binop is legal.

Jul 14 2023, 9:58 AM · Restricted Project, Restricted Project

Jul 13 2023

mgudim added a comment to D152147: [RISCV] Fold binary op into select if profitable..

@craig.topper is it ok to recommit this?

Jul 13 2023, 7:00 AM · Restricted Project, Restricted Project

Jul 12 2023

mgudim committed rG17e2df6695d3: [RISCV] Removed the requirement of XLenVT for performSELECTCombine. (authored by mgudim).
[RISCV] Removed the requirement of XLenVT for performSELECTCombine.
Jul 12 2023, 1:30 PM · Restricted Project, Restricted Project
mgudim closed D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.
Jul 12 2023, 1:29 PM · Restricted Project, Restricted Project
mgudim added a comment to D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.

@abs Yes, will try to commit this today.

Jul 12 2023, 11:17 AM · Restricted Project, Restricted Project

Jul 11 2023

mgudim added inline comments to D152147: [RISCV] Fold binary op into select if profitable..
Jul 11 2023, 10:56 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

Addressed comments: use plain array instead of SmallVector

Jul 11 2023, 10:55 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

Changed ArrayRef to SmallVector in two more lines, which I missed in the previous update.

Jul 11 2023, 7:10 AM · Restricted Project, Restricted Project

Jul 10 2023

mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

(1) Added a check if FoldConstantArithmetic returns null.
(2) Fixed the incorrect use of ArrayRef. This was causing a bug, which is not visible when compiled in Debug mode.

Jul 10 2023, 2:24 PM · Restricted Project, Restricted Project

Jun 26 2023

mgudim added a comment to D151449: [RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0.

@djtodoro Thanks for working on this. LGTM, given that you fix the tests. I would feel more comfortable if someone else (@asb, @craig.topper, @reames) gave a final approval.

Jun 26 2023, 6:47 AM · Restricted Project, Restricted Project

Jun 22 2023

mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

Can't reproduce the failed tests locally. Put a print statement in the code to make sure it is the most recent patch being tested.

Jun 22 2023, 5:54 AM · Restricted Project, Restricted Project

Jun 20 2023

mgudim updated the diff for D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.

updated tests

Jun 20 2023, 2:16 PM · Restricted Project, Restricted Project
mgudim added a comment to D151449: [RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0.

This also works for CTLZ.

Jun 20 2023, 12:37 PM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..
Jun 20 2023, 12:03 PM · Restricted Project, Restricted Project

Jun 15 2023

mgudim added a comment to D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.

I'll update soon. I just wanted to first see if there are any principal objections.

Jun 15 2023, 9:48 AM · Restricted Project, Restricted Project
mgudim added a comment to D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.

Not sure why we have this restriction. I've ran most of spec without it, all the tests passed and even got some small improvements.

Jun 15 2023, 9:43 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

Uploaded diff with -u99999 for more context.

Jun 15 2023, 9:38 AM · Restricted Project, Restricted Project
mgudim added a reviewer for D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine: craig.topper.
Jun 15 2023, 9:34 AM · Restricted Project, Restricted Project
mgudim requested review of D153044: [RISCV] Removed the requirement of XLenVT for performSELECTCombine.
Jun 15 2023, 9:33 AM · Restricted Project, Restricted Project

Jun 14 2023

mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

added logic for the correct order of operands when creating new opepands of select.
added test for all four possible positions of constants in select and binop.

Jun 14 2023, 3:04 PM · Restricted Project, Restricted Project

Jun 13 2023

mgudim added a comment to rGd0189584631e: [RISCV] Fold binary op into select if profitable..

I'm away from my computer, I'll revert it as soon as I'll get home today, unless someone wants to do it for me earlier.

Jun 13 2023, 5:00 PM · Restricted Project, Restricted Project

Jun 12 2023

mgudim committed rGd0189584631e: [RISCV] Fold binary op into select if profitable. (authored by mgudim).
[RISCV] Fold binary op into select if profitable.
Jun 12 2023, 11:19 AM · Restricted Project, Restricted Project

Jun 8 2023

mgudim added inline comments to D151449: [RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0.
Jun 8 2023, 1:52 PM · Restricted Project, Restricted Project
mgudim added a comment to D151449: [RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0.

see DAGCombiner::SimplifySelectCC for the logic of determining which operand is what. That code also handles CTLZ and case of reversed operands.

Jun 8 2023, 1:49 PM · Restricted Project, Restricted Project
mgudim added a comment to D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.

Does the issue exist on other targets?

Jun 8 2023, 1:00 PM · Restricted Project, Restricted Project
mgudim added a comment to D152147: [RISCV] Fold binary op into select if profitable..

Thanks @craig.topper , I'll merge it (once I figure out the process). What about https://reviews.llvm.org/D151750 Can it be merged after this one?

Jun 8 2023, 12:40 PM · Restricted Project, Restricted Project

Jun 7 2023

mgudim added a comment to D152147: [RISCV] Fold binary op into select if profitable..

Pre-merge checks passed.

Jun 7 2023, 10:53 AM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..
Jun 7 2023, 5:10 AM · Restricted Project, Restricted Project

Jun 6 2023

mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..
Jun 6 2023, 2:03 PM · Restricted Project, Restricted Project
mgudim updated the diff for D152147: [RISCV] Fold binary op into select if profitable..

Addressed comments.
Fixed a bug: the constants were passed to DAG.FoldConstantArithmetic in the wrong order.
Moved call to foldBinOpIntoSelectIfProfitable after combineSelectToBinOp - this way we will not fold binop if the constant of select is already 0 or -1.
Minor typo fixes.

Jun 6 2023, 1:53 PM · Restricted Project, Restricted Project

Jun 5 2023

mgudim added a comment to D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.

I have posted a patch for folding binop into select: https://reviews.llvm.org/D152147
That solves the degradation that @craig.topper pointed out.

Jun 5 2023, 5:49 AM · Restricted Project, Restricted Project
mgudim requested review of D152147: [RISCV] Fold binary op into select if profitable..
Jun 5 2023, 5:45 AM · Restricted Project, Restricted Project

Jun 2 2023

mgudim added a comment to D151659: Constant propogation through freeze instruction.

Is there a way to trigger all the tests before merging?

Jun 2 2023, 2:01 PM · Restricted Project, Restricted Project
mgudim added a comment to D151659: Constant propogation through freeze instruction.

there is this failure on windows:

Jun 2 2023, 1:56 PM · Restricted Project, Restricted Project
mgudim updated the diff for D151659: Constant propogation through freeze instruction.

Added a check if type is struct (followed visitSelect as an example)
added test freeze_struct

Jun 2 2023, 1:53 PM · Restricted Project, Restricted Project

May 31 2023

mgudim added a comment to D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.

I can see two alternatives to the problem you've pointed out.

May 31 2023, 1:17 PM · Restricted Project, Restricted Project
mgudim updated the diff for D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.

(1) Added check for legality of AND
(2) Made the check before insertion of AND stronger. Previous check could be not enough if the type size was not a power of 2.
(3) Updated affected tests

May 31 2023, 8:31 AM · Restricted Project, Restricted Project
mgudim added a comment to D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.

@craig.topper

What if the target doesn't natively support CTLZ/CTTZ and only has CTLZ_ZERO_UNDEF/CTTZ_ZERO_UNDEF will end up with a select followed by the AND? What if the target doesn't support CTTZ/CTLZ at all?

May 31 2023, 5:51 AM · Restricted Project, Restricted Project
mgudim added inline comments to D151758: [Reassociate] Group select of constants together with constants.
May 31 2023, 4:59 AM · Restricted Project, Restricted Project
mgudim added a comment to D151659: Constant propogation through freeze instruction.

Can you please share which Name <email> to use for attribution on the commit?

May 31 2023, 4:45 AM · Restricted Project, Restricted Project

May 30 2023

mgudim added a reviewer for D151758: [Reassociate] Group select of constants together with constants: nikic.
May 30 2023, 3:36 PM · Restricted Project, Restricted Project
mgudim added a comment to D151758: [Reassociate] Group select of constants together with constants.

Posting this as a draft to get some feedback / advice. I am not sure about the following points:

May 30 2023, 3:34 PM · Restricted Project, Restricted Project
mgudim added a reviewer for D151758: [Reassociate] Group select of constants together with constants: wristow.
May 30 2023, 3:24 PM · Restricted Project, Restricted Project
mgudim requested review of D151758: [Reassociate] Group select of constants together with constants.
May 30 2023, 3:23 PM · Restricted Project, Restricted Project
mgudim retitled D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)` from [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), 63)` to [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.
May 30 2023, 2:02 PM · Restricted Project, Restricted Project
mgudim requested review of D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`.
May 30 2023, 2:00 PM · Restricted Project, Restricted Project
mgudim added a comment to D151659: Constant propogation through freeze instruction.

Build passed.

May 30 2023, 11:50 AM · Restricted Project, Restricted Project
mgudim updated the diff for D151659: Constant propogation through freeze instruction.
May 30 2023, 10:15 AM · Restricted Project, Restricted Project
mgudim added a comment to D151659: Constant propogation through freeze instruction.

@fhahn @nikic Can someone please merge this patch for me? I don't have commit rights yet.

May 30 2023, 8:42 AM · Restricted Project, Restricted Project
mgudim updated the diff for D151659: Constant propogation through freeze instruction.

Merged nested ifs into one.

May 30 2023, 8:40 AM · Restricted Project, Restricted Project
mgudim added a comment to D151659: Constant propogation through freeze instruction.

@nikic Thanks for explaining, I understand now. The check was necessary for the test case you suggested. I've updated the diff and included your test case.

May 30 2023, 8:06 AM · Restricted Project, Restricted Project
mgudim updated the diff for D151659: Constant propogation through freeze instruction.

Added the check for potentially poison values.

May 30 2023, 7:46 AM · Restricted Project, Restricted Project

May 29 2023

mgudim added a comment to D151659: Constant propogation through freeze instruction.

@nikic Thanks for taking a look!

May 29 2023, 2:24 PM · Restricted Project, Restricted Project
mgudim requested review of D151659: Constant propogation through freeze instruction.
May 29 2023, 12:49 PM · Restricted Project, Restricted Project

May 18 2023

mgudim added a comment to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

@reames Friendly ping.

May 18 2023, 2:32 PM · Restricted Project, Restricted Project

Dec 15 2022

mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

Removed sve-select.s which was added by accident.

Dec 15 2022, 4:15 AM · Restricted Project, Restricted Project
mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

Added necessary checks missing in previous version. This fixed the failing tests.

Dec 15 2022, 3:00 AM · Restricted Project, Restricted Project

Dec 14 2022

mgudim added inline comments to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Dec 14 2022, 5:52 AM · Restricted Project, Restricted Project
mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

Implemented approach suggested by @reames : instead of considering all the possible cases, assume that the zero constant always appears as the "false" option of select and if not, invert the comparison, switch the true and false option and call foldSelectCCToShiftAnd recursively.

Dec 14 2022, 5:39 AM · Restricted Project, Restricted Project

Dec 8 2022

mgudim added a comment to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

@craig.topper For the test, do you want to go all the way to assembly or stopping after isel is OK? Since the optimization is target-independent, where should the test go? Do you have further comments?

Dec 8 2022, 1:47 AM · Restricted Project, Restricted Project

Nov 17 2022

mgudim added inline comments to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 17 2022, 1:45 AM · Restricted Project, Restricted Project

Nov 14 2022

mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 14 2022, 6:47 AM · Restricted Project, Restricted Project
mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 14 2022, 3:58 AM · Restricted Project, Restricted Project
mgudim updated the summary of D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 14 2022, 3:33 AM · Restricted Project, Restricted Project
mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

When I previously said that now optimization works in all the cases I was wrong. You're right that we don't need to consider the non-strict inequalities. But we still need to extend the logic to work on the "inverted" patterns where the zero is the true value in the select instruction.

Nov 14 2022, 3:31 AM · Restricted Project, Restricted Project

Nov 13 2022

mgudim added a comment to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.

Do the SETLE and SETGE cases occur? I thought DAGCombine always changes those to SETLT and SETGE by changing the constant?

Nov 13 2022, 12:52 AM · Restricted Project, Restricted Project

Nov 10 2022

mgudim edited reviewers for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd, added: reames, tyomitch; removed: amehsan.
Nov 10 2022, 9:12 AM · Restricted Project, Restricted Project
mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 10 2022, 6:46 AM · Restricted Project, Restricted Project

Nov 7 2022

mgudim updated the diff for D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 7 2022, 4:31 AM · Restricted Project, Restricted Project

Nov 4 2022

mgudim added inline comments to D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 4 2022, 6:51 AM · Restricted Project, Restricted Project
mgudim requested review of D137422: [DAGCombine] Generalize foldSelectCCToShiftAnd.
Nov 4 2022, 6:47 AM · Restricted Project, Restricted Project

Jan 20 2020

mgudim added a comment to D72382: [ArgPromotion] Extend search for SafeToUnconditionallyLoad indices to the blocks that must be executed upon entry into the function..

This should fix PR887: https://bugs.llvm.org/show_bug.cgi?id=887
Please verify that and include the test case from there. We should mention it in the commit message and close the bug if it works.

My patch does not make any difference. It looks like 887 is related to pass ordering: the load can be hoisted up into the entry block, but hoisting only runs after argpromotion


This should also fix PR42039: https://bugs.llvm.org/show_bug.cgi?id=42039
Please verify that and include the test case from there. We should mention it in the commit message and close the bug if it works.

With my patch argpromotion does not happen, so I'll add this to the test cases and mention it in commit message.

Jan 20 2020, 11:59 AM · Restricted Project