Page MenuHomePhabricator
Feed Advanced Search

Jul 4 2016

eli.friedman added a comment to D21928: Aliasing of constant pointers (inttoptr Const) for BasicAA.

This is missing a check for the address-space; address-spaces other than zero can behave in strange ways.

Jul 4 2016, 11:36 AM

Jul 2 2016

eli.friedman added a comment to D21948: [DSE] fix - missing store to runtime stack in thunk with tail call bvval arg.

Special-casing this in DSE makes no sense... alias analysis should always return the correct result.

Jul 2 2016, 5:15 PM
eli.friedman updated subscribers of D21948: [DSE] fix - missing store to runtime stack in thunk with tail call bvval arg.
Jul 2 2016, 5:00 PM
eli.friedman added a comment to D21899: [InstCombine] extend (select X, C1, C2 --> ext X) to vectors.

Re: your questions about canonicalization:

Jul 2 2016, 11:51 AM
eli.friedman added a comment to D21899: [InstCombine] extend (select X, C1, C2 --> ext X) to vectors.

Generally looks fine.

Jul 2 2016, 11:20 AM

Jun 29 2016

eli.friedman added a comment to D21740: [InstCombine] extend matchSelectFromAndOr() to work with i1 scalar types.

LGTM.

Jun 29 2016, 5:53 PM
eli.friedman added a comment to D21740: [InstCombine] extend matchSelectFromAndOr() to work with i1 scalar types.

Would it make sense to add "m_SExtOrBool" or something like that, which matches a value which matches either a sext or a value of boolean type? That seems like a cleaner way to generalize the transform.

Jun 29 2016, 4:50 PM

Jun 27 2016

eli.friedman accepted D21690: Fix size computation of array allocation in inline cost analysis.

LGTM.

Jun 27 2016, 3:05 PM
eli.friedman added inline comments to D21613: [DSE] Avoid iterator invalidation bugs..
Jun 27 2016, 11:24 AM

Jun 24 2016

eli.friedman added inline comments to D21690: Fix size computation of array allocation in inline cost analysis.
Jun 24 2016, 5:19 PM
eli.friedman added a comment to D21690: Fix size computation of array allocation in inline cost analysis.

While you're here, could you fix this to handle overflow correctly?

Jun 24 2016, 1:17 PM
eli.friedman added a comment to D21613: [DSE] Avoid iterator invalidation bugs..

" can you please explain why the phi nodes must stick around (at least in the short term)? I don't follow.."

Jun 24 2016, 11:10 AM

Jun 23 2016

eli.friedman accepted D21672: [LICM] Avoid repeating expensive call while promoting loads. NFC.

Nit: in an if-else if, please use braces consistently.

Jun 23 2016, 7:09 PM
eli.friedman added a comment to D21613: [DSE] Avoid iterator invalidation bugs..

Oh, I see what you mean about the rL273141 testcase; I thought the stores in the testcase were ordered differently. You run into the issue I was describing if you reorder the last two stores, like this:

Jun 23 2016, 10:31 AM

Jun 22 2016

eli.friedman added a comment to D21460: [JumpThreading] Fix handling of aliasing metadata..

It should be possible to merge it together... actually, that's probably a good idea considering the number of different versions we have of essentially the same code. GVN has a version (and is missing checks in a couple places), Instcombine has two versions, EarlyCSE has a version (and is missing checks in a couple of places), BBVectorize has a version. Basically, it's a mess. We probably want a general "CSE-metadata" utility. (There's probably also room for a "hoist-metadata" utility.)

Jun 22 2016, 9:54 PM
eli.friedman added a comment to D21613: [DSE] Avoid iterator invalidation bugs..

It's no problem that you're stealing some of my changes. :)

Jun 22 2016, 11:21 AM
eli.friedman accepted D21610: [ValueTracking] improve ComputeNumSignBits for vectors.

I did a bit of digging about the "Mask <<= Mask.getBitWidth()-TyBits;" thing; it looks like r47654 is at fault. (The original version of the code used uint64_t instead of APInt.)

Jun 22 2016, 10:35 AM

Jun 21 2016

eli.friedman requested changes to D21496: LoadCombine Load Aliasing Fix.

I was going over this one more time before committing it... and I realized you don't actually have any test coverage for this change. I'm pretty sure the given testcase passes without your patch.

Jun 21 2016, 7:20 PM

Jun 20 2016

eli.friedman added a comment to D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

Oh, right... there's a fix for that in http://reviews.llvm.org/D21460, but that still waiting for review. I'll split it off into a separate commit.

Jun 20 2016, 8:52 PM
eli.friedman added a comment to D21534: GlobalISel: first outline of legalization interface..

I'm not sure ScalarInVectorActions covers all the possibilities for legalization... for example, x86 prefers to legalize <4 x i16> to <4 x i32> rather than <8 x i16>.

Jun 20 2016, 3:13 PM
eli.friedman accepted D21496: LoadCombine Load Aliasing Fix.
Jun 20 2016, 11:23 AM
eli.friedman added a comment to D21496: LoadCombine Load Aliasing Fix.

LGTM. If you don't have commit access, I'll commit this for you.

Jun 20 2016, 11:23 AM
eli.friedman added inline comments to D21291: [SimplifyCFG] Range reduce switches.
Jun 20 2016, 10:50 AM
eli.friedman added a comment to D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

I can add a comment; it would look something like this:

Jun 20 2016, 9:57 AM

Jun 19 2016

eli.friedman added inline comments to D21291: [SimplifyCFG] Range reduce switches.
Jun 19 2016, 2:59 PM
eli.friedman added inline comments to D21496: LoadCombine Load Aliasing Fix.
Jun 19 2016, 2:19 PM
eli.friedman added inline comments to D21496: LoadCombine Load Aliasing Fix.
Jun 19 2016, 1:39 PM

Jun 18 2016

eli.friedman added inline comments to D21496: LoadCombine Load Aliasing Fix.
Jun 18 2016, 7:25 PM
eli.friedman added inline comments to D21496: LoadCombine Load Aliasing Fix.
Jun 18 2016, 7:02 PM
eli.friedman added inline comments to D21496: LoadCombine Load Aliasing Fix.
Jun 18 2016, 6:24 PM

Jun 17 2016

eli.friedman retitled D21460: [JumpThreading] Fix handling of aliasing metadata. from to [JumpThreading] Fix handling of aliasing metadata..
Jun 17 2016, 12:24 AM

Jun 16 2016

eli.friedman added a comment to D20638: [LIR] Fix mis-compilation with unwinding.

Are you planning to continue working on this?

Jun 16 2016, 3:43 PM
eli.friedman added a comment to D21190: [InstCombine] allow more than one use for vector cast folding with selects.

I think I should limit this patch to only bitcasts to make it safer?

Jun 16 2016, 1:42 PM
eli.friedman added a comment to D20847: BitCast infinite loop fix.

I would be in favor of reverting r263734+r270135 (i.e. delete optimizeBitCastFromPhi); r263734 clearly slipped through without sufficient review.

Jun 16 2016, 11:16 AM
eli.friedman accepted D21190: [InstCombine] allow more than one use for vector cast folding with selects.

This patch doesn't only apply to bitcasts, which can lead to gigantic codegen changes in some cases. That isn't a new problem, though; consider:

Jun 16 2016, 10:48 AM

Jun 15 2016

eli.friedman added inline comments to D20116: Add speculatable function attribute.
Jun 15 2016, 11:40 PM
eli.friedman closed D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

http://reviews.llvm.org/rL272868

Jun 15 2016, 7:43 PM
eli.friedman added a comment to D20379: Codegen: Fix broken assumption in Tail Merge..

Err, are you talking about https://github.com/llvm-mirror/llvm/blob/961fcb527d3c49bfcf9d6ff212cca3dc15682dbe/lib/CodeGen/MachineLICM.cpp#L869 ? You can't write a constant pool load in IR. You can write something like store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32*> @g, and SelectionDAG will generate a constant pool load.

Jun 15 2016, 6:05 PM
eli.friedman added inline comments to D21291: [SimplifyCFG] Range reduce switches.
Jun 15 2016, 4:39 PM
eli.friedman added inline comments to D21291: [SimplifyCFG] Range reduce switches.
Jun 15 2016, 1:59 PM

Jun 14 2016

eli.friedman added a comment to D21318: GlobalsAA: Functions with the argmemonly attribute won't read arbitrary globals.

For the testcase, maybe try passing "-disable-basicaa"? Or maybe come up with something BasicAA can't analyze, like a call to a function which calls an argmemonly function.

Jun 14 2016, 8:22 PM
eli.friedman added a comment to D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

Yes, it's good to go; I'll commit it tonight (assuming nobody else gets to it first).

Jun 14 2016, 10:02 AM

Jun 13 2016

eli.friedman added a comment to D21041: [GVN] PRE can't hoist loads across calls in general..

Yuck, how have we managed to be this wrong for this long and not notice it?

Jun 13 2016, 11:59 PM
eli.friedman added a comment to D21237: LoopRotation: remove iterative calls to rotateLoops.

In general, loop rotation is just "split the header block into two versions", which is precisely the sort of transform jump threading does. Actually, the only reason JumpThreading doesn't rotate loops at the moment is that it's explicitly suppressed for loop headers.

Jun 13 2016, 5:19 PM
eli.friedman added a comment to D21291: [SimplifyCFG] Range reduce switches.

Maybe it makes sense to perform this sort of transformation in SelectionDAGBuilder::visitSwitch instead? Most of the relevant logic is there.

Jun 13 2016, 1:26 PM

Jun 12 2016

eli.friedman accepted D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

Does it mean that if that store is not merged with something else in a similar way it can be incorrectly optimized?

Jun 12 2016, 7:22 PM
eli.friedman added a comment to D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding.

In the CSE case, we aren't guaranteed that the metadata on the first load makes sense: the optimizer is allowed to insert a load anywhere with any metadata as long as it can guarantee it's safe to dereference. So we have to merge the metadata to ensure correct behavior. (Realistically, we might end up in this situation by hoisting a dead load.)

Jun 12 2016, 3:21 PM
eli.friedman updated the diff for D21041: [GVN] PRE can't hoist loads across calls in general..

Improved control-flow check, fix for scalar PRE.

Jun 12 2016, 1:00 PM

Jun 9 2016

eli.friedman added a comment to D21190: [InstCombine] allow more than one use for vector cast folding with selects.

Looking a bit more, I think the infinite loop isn't possible because of the way instcombine works with PHI nodes and the reachable code restriction. Sorry about the false alarm.

Jun 9 2016, 2:40 PM
eli.friedman added a comment to D21190: [InstCombine] allow more than one use for vector cast folding with selects.

Something like this?

Jun 9 2016, 1:15 PM
eli.friedman added a comment to D21190: [InstCombine] allow more than one use for vector cast folding with selects.

Is it possible that this could cause an infinite loop in instcombine? Previously, this transform always reduced the total number of bitcasts in the function, but this doesn't. (Consider the case where the select uses its own result.)

Jun 9 2016, 11:52 AM

Jun 8 2016

eli.friedman added a comment to D21167: [LICM] Make isGuaranteedToExecute more accurate..

I don't think anything has changed for "halting" since the last time it was discussed, about a year ago. I mean, we probably get a lot of the benefit by just marking all the LLVM intrinsics and libcalls halting (which is straightfoward, but tedious to go through and find the exceptions). We can add some additional markings in clang for stuff marked pure. Beyond that, for a function definition, the rules are that it doesn't unwind, doesn't call any non-halting function, and doesn't have any infinite loops. Finding calls to non-halting functions is easy. Not sure how we solve whether whether a function has an infinite loop; I think that was still up in the air the last time it was discussed. I think there's still some sort of pass manager problem that prevents accessing SCEV from functionattrs? Also, some people would prefer to assume side-effect-free loops terminate in C/C++, and it isn't clear exactly what accommodations we have to make for that.

Jun 8 2016, 9:06 PM
eli.friedman retitled D21167: [LICM] Make isGuaranteedToExecute more accurate. from to [LICM] Make isGuaranteedToExecute more accurate..
Jun 8 2016, 7:31 PM
eli.friedman added inline comments to D21144: [X86]: Quit promoting 8 and 16 bit compares to 32 bit..
Jun 8 2016, 2:20 PM
eli.friedman added a comment to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.

LGTM, but this has been though a lot of revisions, so it's probably a good idea to someone else to double-check I didn't miss something obvious.

Jun 8 2016, 2:09 PM
eli.friedman added inline comments to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.
Jun 8 2016, 12:53 PM
eli.friedman added inline comments to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.
Jun 8 2016, 12:26 AM

Jun 7 2016

eli.friedman added inline comments to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.
Jun 7 2016, 5:22 PM

Jun 6 2016

eli.friedman resigned from D6321: Fix use of DemandedMask to NewMask for SIGN_EXTEND_INREG.
Jun 6 2016, 5:44 PM
eli.friedman added a comment to D21041: [GVN] PRE can't hoist loads across calls in general..

It probably doesn't make sense to turn every call instruction into an invoke or equivalent; that would cause the size of the IR to explode, and make the IR more difficult to use for passes which don't actually care about "trivial" edges (including most of GVN itself).

Jun 6 2016, 4:06 PM
eli.friedman retitled D21041: [GVN] PRE can't hoist loads across calls in general. from to [GVN] PRE can't hoist loads across calls in general..
Jun 6 2016, 2:19 PM
eli.friedman added a comment to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.

This is looking a lot better overall.

Jun 6 2016, 11:09 AM
eli.friedman added a comment to D21007: DSE: Don't remove stores made live by a call which unwinds..

Updated. Unfortunately, the patch gets a lot more complicated because of the need to avoid iterator invalidation. On the plus side, I think I fixed a couple latent iterator invalidation bugs.

Jun 6 2016, 12:18 AM
eli.friedman updated the diff for D21007: DSE: Don't remove stores made live by a call which unwinds..
  • [DSE] Precisely track instructions which may unwind.
Jun 6 2016, 12:17 AM

Jun 5 2016

eli.friedman added inline comments to D21007: DSE: Don't remove stores made live by a call which unwinds..
Jun 5 2016, 4:52 PM
eli.friedman retitled D21007: DSE: Don't remove stores made live by a call which unwinds. from to DSE: Don't remove stores made live by a call which unwinds..
Jun 5 2016, 3:54 PM

Jun 3 2016

eli.friedman added inline comments to D20944: LICM: Don't sink stores out of loops that may throw..
Jun 3 2016, 12:01 AM

Jun 2 2016

eli.friedman added inline comments to D20944: LICM: Don't sink stores out of loops that may throw..
Jun 2 2016, 11:33 PM
eli.friedman retitled D20944: LICM: Don't sink stores out of loops that may throw. from to LICM: Don't sink stores out of loops that may throw..
Jun 2 2016, 7:05 PM
eli.friedman added a comment to D20931: [X86] Reduce the width of multiplification when its operands are extended from i8 or i16.

The testcases are a bit more complicated than they need to be; could you reduce them to just the minimal IR? In particular, including the loops makes it harder to read.

Jun 2 2016, 3:12 PM

Jun 1 2016

eli.friedman added a comment to D20665: Claim NoAlias if two GEPs index different fields of the same struct.

"allocated object" in this context means the entire object returned by something like malloc() or the alloca instruction.

Jun 1 2016, 8:50 PM
eli.friedman added a comment to D20665: Claim NoAlias if two GEPs index different fields of the same struct.

My example run through "clang -S -emit-llvm -O2 -fno-unroll-loops":

Jun 1 2016, 7:29 PM
eli.friedman added a comment to D20665: Claim NoAlias if two GEPs index different fields of the same struct.

Example:

struct A {
  unsigned char a[10];
  unsigned char b;
};
void f(A* x) {
  for (unsigned i = 0; i < 11; ++i)
    x->b += ((unsigned char*)x)[i];
}
Jun 1 2016, 5:49 PM
eli.friedman added inline comments to D20890: [CFLAA] Improving the precision of cfl-aa for inttoptr and ptrtoint.
Jun 1 2016, 5:34 PM
eli.friedman added inline comments to D20665: Claim NoAlias if two GEPs index different fields of the same struct.
Jun 1 2016, 5:08 PM

May 29 2016

eli.friedman updated subscribers of D19178: Broaden FoldItoFPtoI to try and establish whether the integer value fits into the float type.
May 29 2016, 10:31 AM

May 28 2016

eli.friedman added inline comments to D20774: [InstCombine] look through bitcasts to find selects.
May 28 2016, 2:27 PM
eli.friedman added inline comments to D20774: [InstCombine] look through bitcasts to find selects.
May 28 2016, 1:09 PM

May 26 2016

eli.friedman abandoned D20553: Fix over-aggressive call slot optimization in memcpyopt..
May 26 2016, 4:16 PM
eli.friedman added a comment to D20553: Fix over-aggressive call slot optimization in memcpyopt..

It's fine. :)

May 26 2016, 1:03 PM
eli.friedman added inline comments to D20638: [LIR] Fix mis-compilation with unwinding.
May 26 2016, 10:48 AM

May 23 2016

eli.friedman added inline comments to D20555: [MemCpyOpt] Be conservative in the face of returns_twice calls.
May 23 2016, 9:37 PM
eli.friedman added a reviewer for D20553: Fix over-aggressive call slot optimization in memcpyopt.: majnemer.
May 23 2016, 9:23 PM
eli.friedman updated subscribers of D20553: Fix over-aggressive call slot optimization in memcpyopt..
May 23 2016, 9:15 PM
eli.friedman retitled D20553: Fix over-aggressive call slot optimization in memcpyopt. from to Fix over-aggressive call slot optimization in memcpyopt..
May 23 2016, 9:13 PM

Nov 13 2015

eli.friedman added a comment to D14497: [FunctionAttrs] Detect printf-like functions and propagate readonly+nocapture to variadic operands.

sprintf definitely isn't nocapture; simple testcase:

Nov 13 2015, 9:12 PM

Nov 3 2015

eli.friedman added a comment to D14304: [IR] add bounds checking to paramHasAttr.

The FastIsel changes appear to be correct... but probably not the most clear way to write it. It would be better to combine the if statements so it only checks arg_size != 0 once.

Nov 3 2015, 8:28 PM