Page MenuHomePhabricator

sanjoy (Sanjoy Das)
User

Projects

User does not belong to any projects.

User Details

User Since
Jun 6 2014, 4:30 PM (236 w, 1 d)

Recent Activity

Oct 22 2018

sanjoy updated subscribers of D53306: [X86] Stop promoting integer loads to vXi64.

Hi Craig,

Oct 22 2018, 12:49 PM

Oct 15 2018

sanjoy accepted D53282: [SCEV] Limit AddRec "simplifications" to avoid combinatorial explosions.

lgtm

Oct 15 2018, 7:56 AM

Oct 10 2018

sanjoy accepted D53061: [IndVars] Drop "exact" flag from lshr and udiv when substituting their args.

lgtm

Oct 10 2018, 11:24 AM

Oct 8 2018

sanjoy added inline comments to D51207: Introduce llvm.experimental.widenable_condition intrinsic.
Oct 8 2018, 10:54 AM

Oct 5 2018

sanjoy added a comment to D52930: [SCEV][NFC] Verify IR in isLoop[Entry,Backedge]GuardedByCond.

+1 on the general idea, though like Florian I too think this is too expensive for a normal debug build. How about putting it under a flag (putting under EXPENSIVE_CHECKS requires a recompile right?) that can even run on release builds? That flag can even be enabled by default on EXPENSIVE_CHECKS builds.

Oct 5 2018, 9:58 AM

Sep 24 2018

sanjoy added a comment to D51664: [IR] Lazily number instructions for local dominance queries.

If I get no results, at least 1% RSS is an upper bound on increased LTO memory usage. I'm happy to trade that for 40% shorter compile time of the slowest TUs in clang.

Sep 24 2018, 2:29 PM
sanjoy added a comment to D51664: [IR] Lazily number instructions for local dominance queries.

The downside is that Instruction grows from 56 bytes to 64 bytes, and I don't have a good way to measure what that costs in practice.

Sep 24 2018, 11:49 AM

Sep 22 2018

sanjoy added inline comments to D51207: Introduce llvm.experimental.widenable_condition intrinsic.
Sep 22 2018, 11:44 AM

Sep 10 2018

sanjoy added inline comments to D51207: Introduce llvm.experimental.widenable_condition intrinsic.
Sep 10 2018, 2:37 PM

Aug 24 2018

sanjoy added a comment to D51207: Introduce llvm.experimental.widenable_condition intrinsic.

Conceptually this seems fine to me, but I won't have time to do a proper review.

Aug 24 2018, 9:07 AM
sanjoy removed a reviewer for D51207: Introduce llvm.experimental.widenable_condition intrinsic: sanjoy.
Aug 24 2018, 9:06 AM

Aug 20 2018

sanjoy accepted D45300: Update MemorySSA BasicBlockUtils..

lgtm

Aug 20 2018, 2:24 PM

Aug 18 2018

sanjoy added inline comments to D49156: [MemorySSA] Add API to update MemoryPhis, following CFG changes..
Aug 18 2018, 12:22 PM
sanjoy added a comment to D50558: [MustExecute] Fix algorithmic bug in isGuaranteedToExecute. PR38514.

Actually this logic is accidentally correct right now because isGuaranteedToTransferExecutionToSuccessor thinks that volatile loads don't transfer execution to successors (which was under discurrion and probably needs removed) and MustExecute is super-conservative about such instructions in non-header blocks (see https://reviews.llvm.org/D50377). When MustThrow analysis becomes less restrictive, this problem becomes a real one and we hoist sdiv from such examples despite the fact that they are no longer "finite" according to C++ specification.

Aug 18 2018, 11:58 AM

Aug 16 2018

sanjoy added a comment to D50558: [MustExecute] Fix algorithmic bug in isGuaranteedToExecute. PR38514.

JFYI this is somewhat of a hornet's nest -- I believe cases like test_impossible_exit_in_untaken_block are actually correct for C/C++ because infloops without side effects are UB.

Aug 16 2018, 8:47 PM

Aug 14 2018

sanjoy added a comment to D45151: [LICM] Hoisting invariant.group loads.

I'm sorry I can't be more decisive here since I wasn't deeply involved with the devirtualization work early on and so lack a lot of context. The general direction here seems fine to me -- given that we use metadata to express a large range of things, it seems ok to have metadata specific MD dropping policies. However, given that Hal originally objected to this, we should make sure he is on board.

Aug 14 2018, 3:46 PM

Aug 13 2018

sanjoy added a comment to D45151: [LICM] Hoisting invariant.group loads.

Can we spec !invariant.group in a way that lets us always keep the metadata when hoisting? Right now it isn't clear what happens if its contract is violated, i.e. what the behavior of this program is:

Aug 13 2018, 10:57 AM
sanjoy added a comment to D50497: [AliasSetTracker] Do not treat experimental_guard intrinsic as memory writing instruction.

Even if we have to make this same change to AST after using inaccessiblememonly for guards, that seems cleaner than special casing guards here.

Aug 13 2018, 10:51 AM
sanjoy added a comment to D50497: [AliasSetTracker] Do not treat experimental_guard intrinsic as memory writing instruction.

Will marking guards with inaccessiblememonly do the right thing?

Aug 13 2018, 10:51 AM

Aug 9 2018

sanjoy added a comment to D50501: [LICM] Hoist guards with invariant conditions.

Didn't look at the code, but this needs a test case that shows we don't hoist the second guard in

Aug 9 2018, 11:40 AM

Aug 3 2018

sanjoy added a comment to D50248: [GuardWidening] Insert fictive guards to loop preheader to increase chances of widening.

Did you consider phrasing this as an "LICM" on guard? It is a bit of a code smell in LLVM to do an operation speculatively and then undo it immediately.

Aug 3 2018, 6:48 AM

Aug 2 2018

sanjoy added a reviewer for D50167: RFC: [SCEV] Add explicit representations of umin/smin: mkazantsev.
Aug 2 2018, 9:29 AM
sanjoy accepted D48283: [SCEV] Properly solve quadratic equations.

lgtm

Aug 2 2018, 9:25 AM

Aug 1 2018

sanjoy added a comment to D48283: [SCEV] Properly solve quadratic equations.

Only one non-trivial question inline.

Aug 1 2018, 11:05 AM

Jul 31 2018

sanjoy added a comment to D48283: [SCEV] Properly solve quadratic equations.

Now that the code is in APInt we should have some tests in unittests/ADT/APIntTest.cpp. Can we pull in some subset of D50095 that runs within a reasonable amount of time (only bitwidth 4, for instance)?

Jul 31 2018, 3:08 PM

Jul 28 2018

sanjoy added a comment to D48283: [SCEV] Properly solve quadratic equations.

I didn't review the math, but I think there are some easy steps we can take to make this more watertight. Firstly, the code that operates purely on APInt should be moved to APInt.h. With that, we should be able to brute-force all possible inputs for a small bitwidth (i3 or i4) and check that the solutions are correct. What do you think?

Jul 28 2018, 2:59 PM

Jul 26 2018

sanjoy accepted D49832: [SCEV] Don't expand Wrap predicate using inttoptr in ni addrspaces.

lgtm

Jul 26 2018, 9:17 AM

Jul 18 2018

sanjoy accepted D49471: [SCEV] Fix buggy behavior in getAddExpr with truncs.

lgtm

Jul 18 2018, 9:35 AM

Jul 11 2018

sanjoy accepted D49049: [LSR] If no Use is interesting, early return..

I'd debug this a bit further, perhaps with some logging statements to figure out what happened (what use did we discard as non-interesting and why?). But if that looks like too much work then this change as-is is fine too.

Jul 11 2018, 6:23 AM

Jul 8 2018

sanjoy added a comment to D49042: [LangRef] Clarify alloca of zero bytes..

Does this mean we can "construct" undef as:

Jul 8 2018, 11:18 AM
sanjoy added inline comments to D49041: [LangRef] Clarify undefined behavior for function attributes..
Jul 8 2018, 10:48 AM

Jul 6 2018

sanjoy requested changes to D49049: [LSR] If no Use is interesting, early return..

Do you have a test case for this?

Jul 6 2018, 6:57 PM

Jul 2 2018

sanjoy accepted D48409: [SCEV] Strengthen StrengthenNoWrapFlags (reapply r334428)..

lgtm

Jul 2 2018, 11:42 AM

Jun 27 2018

sanjoy accepted D47352: [instsimplify] Move the instsimplify pass to use more obvious file names and diretory..
Jun 27 2018, 11:23 AM

Jun 26 2018

sanjoy accepted D48399: [ConstantRange] Add support of mul in makeGuaranteedNoWrapRegion..

LGTM modulo comments on the test coverage inline.

Jun 26 2018, 11:31 AM
sanjoy added a comment to D48597: [LoopInstSimplify] Discard SCEV if simplification happened..

IMO this doesn't seem like an invalidation bug -- SCEV Expander needs to be smarter about dealing with these kinds of simplifications.

Does this sound better?

Jun 26 2018, 10:19 AM
sanjoy added a comment to D48597: [LoopInstSimplify] Discard SCEV if simplification happened..

IMO this doesn't seem like an invalidation bug -- SCEV Expander needs to be smarter about dealing with these kinds of simplifications.

Jun 26 2018, 9:09 AM

Jun 25 2018

sanjoy accepted D48498: [APInt] Add helpers for rounding u/sdivs..

lgtm

Jun 25 2018, 3:57 PM

Jun 22 2018

sanjoy added inline comments to D48498: [APInt] Add helpers for rounding u/sdivs..
Jun 22 2018, 2:26 PM

Jun 21 2018

sanjoy requested changes to D48399: [ConstantRange] Add support of mul in makeGuaranteedNoWrapRegion..
Jun 21 2018, 10:01 PM
sanjoy accepted D48470: [LegacyPM] Fix PR37888 by teaching the legacy loop pass manager how to clear out deleted loops from the current queue beyond just the current loop..
Jun 21 2018, 7:10 PM
sanjoy added a comment to D47895: llvm: Add support for "-fno-delete-null-pointer-checks".

Drive by comments

Jun 21 2018, 1:15 PM

Jun 20 2018

sanjoy added a comment to D48338: [SCEV] Improve zext(A /u B) and zext(A % B).

I agree with Tim that this is best discussed on llvm-dev, but SCEV generally tries to push zext and sext towards the expression leaves (as Tim already pointed out, I noticed after typing this :) ). The canonical example of this is add recurrences -- SCEV tries very hard to transform zext{A,+,B} to {zext A,+,zext B}.

Jun 20 2018, 9:12 PM
sanjoy accepted D48338: [SCEV] Improve zext(A /u B) and zext(A % B).
Jun 20 2018, 6:38 PM

Jun 19 2018

sanjoy requested changes to D48338: [SCEV] Improve zext(A /u B) and zext(A % B).
Jun 19 2018, 4:07 PM

Jun 18 2018

sanjoy committed rL335016: Revert "[SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags".
Revert "[SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags"
Jun 18 2018, 9:14 PM

Jun 17 2018

sanjoy added inline comments to D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata..
Jun 17 2018, 11:43 AM

Jun 16 2018

sanjoy added inline comments to D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata..
Jun 16 2018, 12:25 PM
sanjoy added a comment to D47963: [LangRef] nnan and ninf produce poison..

I think we should have these produce poison -- if we have them produce undef we'll have the same kinds of problems as we have with regular undef.

Jun 16 2018, 11:49 AM

Jun 15 2018

sanjoy accepted D48238: [SCEV] Simplify some flags expressions..

lgtm, thanks!

Jun 15 2018, 2:41 PM
sanjoy accepted D48237: [SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV..

lgtm, thanks!

Jun 15 2018, 2:41 PM

Jun 14 2018

sanjoy accepted D48158: [SCEV] Simplify zext/trunc idiom that appears when handling bitmasks..

lgtm

Jun 14 2018, 10:03 AM
sanjoy accepted D48160: [SCEV] Simplify trunc-of-add/mul to add/mul-of-trunc under more circumstances..

lgtm

Jun 14 2018, 9:41 AM

Jun 11 2018

sanjoy added a comment to D48041: [SCEV] Add transform zext((A * B * ...)<nuw>) --> (zext(A) * zext(B) * ...)<nuw>..

Hi Justin,

This (or the previous) commit caused a ~1.4% compile time slowdown on CTMark/mafft/pairlocalalign. Any ideas on how we can avoid it?

Jun 11 2018, 8:52 PM
sanjoy accepted D48038: [SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags where safe..

lgtm!

Jun 11 2018, 12:00 PM
sanjoy accepted D48041: [SCEV] Add transform zext((A * B * ...)<nuw>) --> (zext(A) * zext(B) * ...)<nuw>..

lgtm

Jun 11 2018, 11:58 AM

Jun 10 2018

sanjoy accepted D46706: [PM/LoopUnswitch] Support partial trivial unswitching..

This lgtm.

Jun 10 2018, 8:43 PM
sanjoy added a comment to D46760: [InstCombine] Enhance narrowUDivURem..

Bixia - is it correct to say that the behavior we want here is that we narrow arithmetic operations from 64 bits to 32 bits, irrespective of how many extra zero extend instructions we need to add? If yes, perhaps this isn't a good match for InstCombine and we should be looking at a specialized target-dependent transformation pass? InstCombine is a "mini LLVM" in that many LLVM passes have a simpler "do no harm" variant implemented in InstCombine, so this won't be anything new design-wise.

Jun 10 2018, 8:16 PM

Jun 9 2018

sanjoy added a comment to D47767: [SCEV] Drop cached info after late nsw/nuw flags setting.

Can you please also add a SCEV-only test case?

Jun 9 2018, 10:59 PM
sanjoy accepted D47974: [SimplifyIndVars] Ignore dead users.

lgtm

Jun 9 2018, 10:55 PM

Jun 8 2018

sanjoy added inline comments to D47965: [SCEV] Canonicalize "A /u C1 /u C2" to "A /u (C1*C2)"..
Jun 8 2018, 7:33 PM
sanjoy accepted D47965: [SCEV] Canonicalize "A /u C1 /u C2" to "A /u (C1*C2)"..
Jun 8 2018, 7:32 PM
sanjoy accepted D47951: [SCEV] Look through zero-extends in howFarToZero.

lgtm

Jun 8 2018, 1:35 PM
sanjoy added inline comments to D47951: [SCEV] Look through zero-extends in howFarToZero.
Jun 8 2018, 11:34 AM

Jun 1 2018

sanjoy accepted D47647: [PM/LoopUnswitch] Fix how the cloned loops are handled when updating analyses..

lgtm

Jun 1 2018, 6:09 PM

May 29 2018

sanjoy added a comment to D46760: [InstCombine] Enhance narrowUDivURem..

The transformation we really want is: (Z(A) / N) * N + Z(A) % N => Z(A) where Z(...) is zero extension. Maybe we can do that directly instead of reasoning about use lists like this (if we do it directly we will trivially not be increasing the number of zero extensions)?

May 29 2018, 4:25 PM
sanjoy accepted D47408: [PM/LoopUnswitch] When using the new SimpleLoopUnswitch pass, schedule loop-cleanup passes at the beginning of the loop pass pipeline, and re-enqueue loops after even trivial unswitching..

lgtm

May 29 2018, 2:03 PM
sanjoy accepted D47407: [LoopInstSimplify] Re-implement the core logic of loop-instsimplify to be both simpler and substantially more efficient..
May 29 2018, 12:07 PM
sanjoy added a comment to D47214: [InstCombine] Replace bcmp/bcopy with memcmp/memmove.

Maybe try to come up with at least a microbenchmark that would show the gain. You can also benchmark LNT test suite and see if there is any improvement, but the microbenchmark should be easier.

May 29 2018, 10:19 AM

May 24 2018

sanjoy accepted D47353: Restore the LoopInstSimplify pass, reverting r327329 that removed it..

lgtm

May 24 2018, 6:33 PM
sanjoy added a comment to D47327: Check that memory allocation succeeds before use..

As llvm is mostly an api, i assumed that it would be robust and this was a one-off.
Anything big should be done automagically, so i am going to look at sic-ing clang-tidy and/or the static analyzer at this problem.

May 24 2018, 1:39 PM
sanjoy added inline comments to D46706: [PM/LoopUnswitch] Support partial trivial unswitching..
May 24 2018, 11:47 AM
sanjoy added a comment to D47327: Check that memory allocation succeeds before use..

I will change this to try-catch

May 24 2018, 10:11 AM

May 23 2018

sanjoy accepted D47139: [NaryReassociate] Detect deleted instr with WeakTrackingVH.

lgtm

May 23 2018, 1:13 PM
sanjoy added a comment to D47139: [NaryReassociate] Detect deleted instr with WeakTrackingVH.

I end up with infinite loops when trying the lazy approach. As I'm not really familiar with the the algorithm used, I instead made this minimal change to fix the problem I saw in pr37539.

May 23 2018, 9:30 AM

May 22 2018

sanjoy added a comment to D47214: [InstCombine] Replace bcmp/bcopy with memcmp/memmove.

I have no benchmarks. But changing them to mem-functions allows us to apply another set of transformations in "optimizeMemcmp/Memmove".

May 22 2018, 2:21 PM
sanjoy requested changes to D47139: [NaryReassociate] Detect deleted instr with WeakTrackingVH.
May 22 2018, 2:13 PM
sanjoy added a comment to D47214: [InstCombine] Replace bcmp/bcopy with memcmp/memmove.

why?

Anyway these functions call mem* functions, so why not call them directly?

May 22 2018, 2:06 PM

May 11 2018

sanjoy committed rL332101: Use iteration instead of recursion in CFIInserter.
Use iteration instead of recursion in CFIInserter
May 11 2018, 8:58 AM
sanjoy closed D46671: Use iteration instead of recursion in CFIInserter.
May 11 2018, 8:58 AM

May 10 2018

sanjoy added a comment to D46706: [PM/LoopUnswitch] Support partial trivial unswitching..

Actually now that I think of it, I wonder if looking back through the condition expression tree to find all loop invariant values is necessary -- if we see these kinds of cases (loop_varying & loop_invariant0) & loop_invariant1) then perhaps we should teach LICM et. al. to reassociate and hoist the loop_invariant0 & loop_invariant1 bit instead of worrying about them in loop unswitch?

May 10 2018, 4:40 PM
sanjoy added inline comments to D46706: [PM/LoopUnswitch] Support partial trivial unswitching..
May 10 2018, 4:32 PM
sanjoy updated subscribers of D46706: [PM/LoopUnswitch] Support partial trivial unswitching..
May 10 2018, 11:23 AM
sanjoy updated the diff for D46671: Use iteration instead of recursion in CFIInserter.
  • fix bug + test case
May 10 2018, 10:33 AM
sanjoy added a comment to D46671: Use iteration instead of recursion in CFIInserter.

Incoming offset/register values of each successor block should match outgoing offset/register values of its predecessors.

May 10 2018, 10:32 AM

May 9 2018

sanjoy updated the diff for D46671: Use iteration instead of recursion in CFIInserter.
  • Use SmallVector::append
May 9 2018, 6:54 PM
sanjoy added inline comments to D46671: Use iteration instead of recursion in CFIInserter.
May 9 2018, 6:54 PM
sanjoy created D46671: Use iteration instead of recursion in CFIInserter.
May 9 2018, 6:23 PM
sanjoy accepted D46647: [InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor.

lgtm

May 9 2018, 3:24 PM
sanjoy added inline comments to D46647: [InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor.
May 9 2018, 1:56 PM
sanjoy added inline comments to D46647: [InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor.
May 9 2018, 10:52 AM

May 8 2018

sanjoy accepted D46046: [SCEV] Do not use induction in isKnownPredicate for simplification umax.

lgtm

May 8 2018, 9:47 PM

Apr 30 2018

sanjoy accepted D46290: Remove \brief commands from doxygen comments..

lgtm

Apr 30 2018, 2:34 PM

Apr 29 2018

sanjoy added a comment to D46046: [SCEV] Do not use induction in isKnownPredicate for simplification umax.

I'm a bit worried about adding yet another IsKnownViaXXX codepath (there are already too many!). Can we be a bit smarter in isKnownPredicate so that it avoids the recursive compile time blowup? If that's not possible, can we instead push the logic in isKnownPredicateWithoutInduction into isKnownViaNonRecursiveReasoning?

Apr 29 2018, 11:31 AM

Apr 26 2018

sanjoy added a comment to D44677: [SCEV] Make computeExitLimit more simple and more powerful.

computeExitLimit's logic shouldn't care if the exiting block is inside a nested loop, as long as the condition is invariant relative to the inner loop. (This should work correctly, as far as I can tell; if it doesn't, it would be easy to fix.) So the question is if there's some invariant related to the caching?

Apr 26 2018, 2:10 PM
sanjoy committed rL330992: [InstCombine] Simplify Add with remainder expressions as operands..
[InstCombine] Simplify Add with remainder expressions as operands.
Apr 26 2018, 1:56 PM
sanjoy closed D45976: [InstCombine] Simplify Add with remainder expressions as operands..
Apr 26 2018, 1:56 PM
sanjoy committed rL330991: Add test cases to prepare for the optimization that simplifies Add with.
Add test cases to prepare for the optimization that simplifies Add with
Apr 26 2018, 1:55 PM
sanjoy closed D46017: Add test cases to prepare for the optimization that simplifies Add with remainder expressions as operands..
Apr 26 2018, 1:55 PM
sanjoy accepted D45976: [InstCombine] Simplify Add with remainder expressions as operands..

lgtm with minor nits.

Apr 26 2018, 12:38 PM