Page MenuHomePhabricator

MehrHeidar (Mehrnoosh Heidarpour)
User

Projects

User does not belong to any projects.

User Details

User Since
Apr 3 2021, 8:44 AM (70 w, 3 d)

Recent Activity

Dec 23 2021

MehrHeidar committed rG0ff20f2f4448: [InstSimplify] Fold logic AND to zero (authored by MehrHeidar).
[InstSimplify] Fold logic AND to zero
Dec 23 2021, 7:03 AM
MehrHeidar closed D115755: [InstSimplify] Fold logic And to Zero.
Dec 23 2021, 7:03 AM · Restricted Project

Dec 21 2021

MehrHeidar added a comment to D115755: [InstSimplify] Fold logic And to Zero.

LGTM - but please wait to push until @rampitec has another look.

Dec 21 2021, 2:34 PM · Restricted Project
MehrHeidar added a comment to D115755: [InstSimplify] Fold logic And to Zero.

But, this one is not complicated enough to catch this pattern : ) -->(Y ^ (Y | X) ) & ((X | Y) ^ X) --> 0

%or1 = or i32 %y, %x
 %or2 = or i32 %x, %y
 %xor1 = xor i32 %y, %or1
 %xor2 = xor i32 %or2, %x
 %and = and i32 %xor1, %xor2
 ret i32 %and

Unless we have some evidence that this pattern can escape a typical -O1 pipeline, I don't think we need to care about it. %or1 and %or2 should be CSE'd independently of instsimplify. In other words, I think the positive tests only need to include a single 'or' instruction. If you want to include a test with different 'or' instructions to show the limits of instsimplify, that's fine.

Dec 21 2021, 8:24 AM · Restricted Project
MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 21 2021, 8:21 AM · Restricted Project
MehrHeidar updated the diff for D115755: [InstSimplify] Fold logic And to Zero.

Fix name issue in test cases.

Dec 21 2021, 8:19 AM · Restricted Project
MehrHeidar updated the diff for D115755: [InstSimplify] Fold logic And to Zero.

Adding more tests and revising the code for pattern match.

Dec 21 2021, 8:15 AM · Restricted Project
MehrHeidar added a comment to D115755: [InstSimplify] Fold logic And to Zero.

The code seems more complicated than necessary (and the tests less thorough than necessary).
We know that the 'or' instruction is a shared op, so let's match that first and then match it again as a specific value?
If I'm seeing it correctly, that means there are 8 potential commutes:

BinaryOperator *Or;
if (match(Op0, m_c_Xor(m_Value(X), m_BinOp(Or))))
  if (match(Or, m_c_Or(m_Specific(X), m_Value(Y))) &&
      match(Op1, m_c_Xor(m_Specific(Or), m_Specific(Y))))
    return Constant::getNullValue(Op0->getType());

On 2nd thought, that might not be complicated enough. :)
I think this could match a "wrong" binop first (for example Y is an add instruction) and then fail to match the pattern (so we could use even more tests...).
We probably need to use m_CombineAnd to get this to accurately match Op0 and capture the 'or' in one shot:

BinaryOperator *Or;
if (match(Op0, m_c_Xor(m_Value(X),
                       m_CombineAnd(m_BinOp(Or),
                                    m_c_Or(m_Deferred(X), m_Value(Y))))) &&
    match(Op1, m_c_Xor(m_Specific(Or), m_Specific(Y))))
  return Constant::getNullValue(Op0->getType());
Dec 21 2021, 7:27 AM · Restricted Project

Dec 20 2021

MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 20 2021, 1:04 PM · Restricted Project
MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 20 2021, 10:24 AM · Restricted Project

Dec 16 2021

MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 16 2021, 2:15 PM · Restricted Project
MehrHeidar updated the diff for D115755: [InstSimplify] Fold logic And to Zero.

Revert to first version and add two test cases

Dec 16 2021, 2:11 PM · Restricted Project

Dec 15 2021

MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 15 2021, 2:15 PM · Restricted Project
MehrHeidar updated the diff for D115755: [InstSimplify] Fold logic And to Zero.

Add negative test.

Dec 15 2021, 2:09 PM · Restricted Project
MehrHeidar added inline comments to D115755: [InstSimplify] Fold logic And to Zero.
Dec 15 2021, 12:51 PM · Restricted Project
MehrHeidar updated the diff for D115755: [InstSimplify] Fold logic And to Zero.

Address review comments.

Dec 15 2021, 12:44 PM · Restricted Project

Dec 14 2021

MehrHeidar added a reviewer for D115755: [InstSimplify] Fold logic And to Zero: rampitec.
Dec 14 2021, 1:13 PM · Restricted Project
MehrHeidar updated the summary of D115755: [InstSimplify] Fold logic And to Zero.
Dec 14 2021, 1:11 PM · Restricted Project
MehrHeidar requested review of D115755: [InstSimplify] Fold logic And to Zero.
Dec 14 2021, 1:08 PM · Restricted Project
MehrHeidar committed rGb5c49b62a221: [InstSimplify] Add tests for logic AND; NFC (authored by MehrHeidar).
[InstSimplify] Add tests for logic AND; NFC
Dec 14 2021, 12:56 PM

Dec 4 2021

MehrHeidar committed rGe94134052fda: [InstSimplify] Add logic 'or' fold to -1 (authored by MehrHeidar).
[InstSimplify] Add logic 'or' fold to -1
Dec 4 2021, 12:12 PM
MehrHeidar closed D114996: [InstSimplify] Add logic `or` fold .
Dec 4 2021, 12:11 PM · Restricted Project
MehrHeidar added inline comments to D114996: [InstSimplify] Add logic `or` fold .
Dec 4 2021, 12:05 PM · Restricted Project

Dec 3 2021

MehrHeidar added inline comments to D114996: [InstSimplify] Add logic `or` fold .
Dec 3 2021, 2:44 PM · Restricted Project
MehrHeidar updated the diff for D114996: [InstSimplify] Add logic `or` fold .

Change the test cases and format of the comments to be more consistent with existing ones.

Dec 3 2021, 1:10 PM · Restricted Project
MehrHeidar added inline comments to D114996: [InstSimplify] Add logic `or` fold .
Dec 3 2021, 9:42 AM · Restricted Project
MehrHeidar updated the diff for D114996: [InstSimplify] Add logic `or` fold .

Add more commuted version of test cases.

Dec 3 2021, 9:40 AM · Restricted Project
MehrHeidar added a reviewer for D114996: [InstSimplify] Add logic `or` fold : rampitec.
Dec 3 2021, 7:47 AM · Restricted Project
MehrHeidar updated the diff for D114996: [InstSimplify] Add logic `or` fold .
Dec 3 2021, 7:45 AM · Restricted Project
MehrHeidar abandoned D114992: Add test cases for logic 'or' fold.
Dec 3 2021, 6:55 AM · Restricted Project
MehrHeidar updated the summary of D114996: [InstSimplify] Add logic `or` fold .
Dec 3 2021, 6:51 AM · Restricted Project
MehrHeidar committed rG54dc03b97bfa: [InstSimplify] Add test case for logic 'or' fold; NFC (authored by MehrHeidar).
[InstSimplify] Add test case for logic 'or' fold; NFC
Dec 3 2021, 6:49 AM

Dec 2 2021

MehrHeidar updated the summary of D114992: Add test cases for logic 'or' fold.
Dec 2 2021, 1:52 PM · Restricted Project
MehrHeidar updated the summary of D114992: Add test cases for logic 'or' fold.
Dec 2 2021, 1:52 PM · Restricted Project
MehrHeidar requested review of D114996: [InstSimplify] Add logic `or` fold .
Dec 2 2021, 1:51 PM · Restricted Project
MehrHeidar updated the summary of D114992: Add test cases for logic 'or' fold.
Dec 2 2021, 1:22 PM · Restricted Project
MehrHeidar requested review of D114992: Add test cases for logic 'or' fold.
Dec 2 2021, 1:07 PM · Restricted Project

Nov 29 2021

MehrHeidar committed rGc572eb1ad9d8: [InstCombine] Fold (~A | B) ^ A --> ~(A & B) (authored by MehrHeidar).
[InstCombine] Fold (~A | B) ^ A --> ~(A & B)
Nov 29 2021, 8:31 AM
MehrHeidar closed D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
Nov 29 2021, 8:31 AM · Restricted Project

Nov 27 2021

MehrHeidar added inline comments to D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
Nov 27 2021, 9:43 AM · Restricted Project
MehrHeidar updated the diff for D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).

Addressing review comments.

Nov 27 2021, 9:41 AM · Restricted Project

Nov 24 2021

MehrHeidar added inline comments to D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
Nov 24 2021, 8:48 AM · Restricted Project
MehrHeidar updated the diff for D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).

Addressing review comments.

Nov 24 2021, 8:43 AM · Restricted Project

Nov 23 2021

MehrHeidar added a comment to D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
  1. Please commit the baseline tests, so we see diffs here.
  2. I expect that will show that the commuted variations are not testing what they claim to be testing (you'll need to add instructions to prevent commuting).
  3. Please add tests with extra uses - since we're creating 2 instructions, the fold should be good as long as any one of the intermediate values can be eliminated (has one use).

Side note: @rampitec recently added a matcher that takes a binary opcode as an input. It probably doesn't make sense here, but it's something to think about if we're trying to make logic folds more regular/predictable ('DeMorganize' folds so we handle patterns where 'and' and 'or' operations are swapped).

Nov 23 2021, 2:25 PM · Restricted Project
MehrHeidar updated the diff for D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
Nov 23 2021, 2:13 PM · Restricted Project
MehrHeidar committed rG165a5c62de1b: [InstCombine] Add test cases for D114339; NFC (authored by MehrHeidar).
[InstCombine] Add test cases for D114339; NFC
Nov 23 2021, 11:25 AM
MehrHeidar closed D114436: [InstCombine] Add test cases for D114339; NFC.
Nov 23 2021, 11:25 AM · Restricted Project
MehrHeidar requested review of D114436: [InstCombine] Add test cases for D114339; NFC.
Nov 23 2021, 6:24 AM · Restricted Project

Nov 21 2021

MehrHeidar added reviewers for D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B): spatel, greened, nikic.
Nov 21 2021, 1:40 PM · Restricted Project
MehrHeidar requested review of D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B).
Nov 21 2021, 1:37 PM · Restricted Project

Nov 15 2021

MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec, use git commit --author="Mehrnoosh Heidarpour <mehrnoosh.heidarpour@huawei.com>". If you're --amending you might also need --reset-author.

Although, it was authored by me, I am only at the last line of commit message. You have not used my email address and used your own, this is your patch now.

When LLVM was still in SVN it was impossible to commit under a different name, so it's actually quite common to have the actual author named only in the message.

Nov 15 2021, 3:19 PM · Restricted Project
MehrHeidar abandoned D113945: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 3:14 PM · Restricted Project
MehrHeidar removed reviewers for D113945: [InstSimplify] Fold A|B | (A^B) --> A|B: foad, spatel.
Nov 15 2021, 3:09 PM · Restricted Project
MehrHeidar added a comment to D113945: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 3:08 PM · Restricted Project
MehrHeidar requested review of D113945: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 3:06 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec Can you revert it?

Sure, if you so wish.

Nov 15 2021, 2:53 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec Can you revert it?

Nov 15 2021, 2:50 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec That was not fair, but Sometimes it happens, I think you made a mistake.

Nov 15 2021, 2:49 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec I think you committed this patch with your name and not mine!
I wanted you to only commit it on behalf of me. Right now, it's your patch in the repository!

That's what is there: (authored by MehrHeidar, committed by rampitec): https://reviews.llvm.org/rG193c40e9667ca2b173232b393fc72ea9e4944aa3

Nov 15 2021, 2:45 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

@rampitec I think you committed this patch with your name and not mine!
I wanted you to only commit it on behalf of me. Right now, it's your patch in the repository!

Nov 15 2021, 2:38 PM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

LGTM. Do you need help to push this?

Nov 15 2021, 1:08 PM · Restricted Project
MehrHeidar added inline comments to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 11:47 AM · Restricted Project
MehrHeidar updated the diff for D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

Add two more test cases for commuted or

Nov 15 2021, 11:45 AM · Restricted Project
MehrHeidar added a comment to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

Do you think the patch looks good now? @rampitec @foad
Thanks

Nov 15 2021, 9:44 AM · Restricted Project
MehrHeidar added inline comments to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 9:13 AM · Restricted Project
MehrHeidar updated the diff for D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

Revert m_c_Xor to m_Xor

Nov 15 2021, 9:10 AM · Restricted Project
MehrHeidar added a comment to D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).

LGTM

Do you have enough commits/reviews now to request commit access? ( https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access )

Nov 15 2021, 9:05 AM · Restricted Project
MehrHeidar updated the diff for D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

Rebasing after test cases are added

Nov 15 2021, 7:17 AM · Restricted Project
MehrHeidar added inline comments to D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 15 2021, 5:34 AM · Restricted Project
MehrHeidar updated the diff for D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.

Replace m_Xor with m_c_Xor

Nov 15 2021, 5:23 AM · Restricted Project

Nov 14 2021

MehrHeidar added reviewers for D113861: [InstSimplify] Fold A|B | (A^B) --> A|B: spatel, foad, rampitec, nikic.
Nov 14 2021, 1:09 PM · Restricted Project
MehrHeidar updated the summary of D113860: [NFC][InstSimplify] add test cases with base results for or-xor fold.
Nov 14 2021, 1:06 PM · Restricted Project
MehrHeidar requested review of D113861: [InstSimplify] Fold A|B | (A^B) --> A|B.
Nov 14 2021, 1:06 PM · Restricted Project
MehrHeidar updated the summary of D113860: [NFC][InstSimplify] add test cases with base results for or-xor fold.
Nov 14 2021, 1:04 PM · Restricted Project
MehrHeidar updated the summary of D113860: [NFC][InstSimplify] add test cases with base results for or-xor fold.
Nov 14 2021, 12:41 PM · Restricted Project
MehrHeidar updated the summary of D113860: [NFC][InstSimplify] add test cases with base results for or-xor fold.
Nov 14 2021, 12:41 PM · Restricted Project
MehrHeidar requested review of D113860: [NFC][InstSimplify] add test cases with base results for or-xor fold.
Nov 14 2021, 12:40 PM · Restricted Project
MehrHeidar updated the diff for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).

Rebase after pre-committing the test cases with base result.

Nov 14 2021, 11:07 AM · Restricted Project
MehrHeidar added a reviewer for D113846: [InstCombine] Pre-commit tests with baseline results : spatel.
Nov 14 2021, 8:08 AM · Restricted Project
MehrHeidar added inline comments to D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).
Nov 14 2021, 7:20 AM · Restricted Project
MehrHeidar requested review of D113846: [InstCombine] Pre-commit tests with baseline results .
Nov 14 2021, 7:13 AM · Restricted Project
MehrHeidar updated the diff for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).

Add a comment to clarify the Op0 in the or operation is guaranteed to be not in the foldable pattern due to the swap that is happening before.

Nov 14 2021, 6:52 AM · Restricted Project

Nov 13 2021

MehrHeidar updated the diff for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).

Modify name of one of the values in one of the test cases added in previous commit.

Nov 13 2021, 10:51 AM · Restricted Project
MehrHeidar added inline comments to D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).
Nov 13 2021, 10:42 AM · Restricted Project
MehrHeidar updated the diff for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).

Addressing review comments.

Nov 13 2021, 10:36 AM · Restricted Project

Nov 12 2021

MehrHeidar added reviewers for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B): spatel, foad.
Nov 12 2021, 10:42 AM · Restricted Project
MehrHeidar updated the diff for D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).
Nov 12 2021, 10:37 AM · Restricted Project
MehrHeidar requested review of D113783: [InstCombine] Fold (A^B)|~A-->~(A&B).
Nov 12 2021, 10:24 AM · Restricted Project

Apr 14 2021

MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 14 2021, 11:25 AM · Restricted Project
MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.

The test case for negative values with nuw flag is added.

Apr 14 2021, 4:10 AM · Restricted Project

Apr 12 2021

MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.

I have updated the condition for preserving the nuw flag.
@nikic Do you think it looks good now?

Apr 12 2021, 2:46 PM · Restricted Project
MehrHeidar planned changes to D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 12 2021, 7:32 AM · Restricted Project
MehrHeidar added inline comments to D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 12 2021, 7:27 AM · Restricted Project
MehrHeidar added inline comments to D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 12 2021, 7:25 AM · Restricted Project

Apr 9 2021

MehrHeidar updated the summary of D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 1:05 PM · Restricted Project
MehrHeidar updated the summary of D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 1:04 PM · Restricted Project
MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 12:16 PM · Restricted Project
MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 10:35 AM · Restricted Project
MehrHeidar updated the diff for D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 10:26 AM · Restricted Project
MehrHeidar updated the summary of D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations.
Apr 9 2021, 7:28 AM · Restricted Project