Page MenuHomePhabricator
Feed Advanced Search

Yesterday

nlopes added a comment to D70246: [InstCombine] remove identity shuffle simplification for mask with undefs.

Let me give my 2c: eliminating this transformation is a good thing, since it's incorrect (end-to-end miscompilation testcase in the cited bug report).
It can be re-instated if/when we switch from initializing vectors with undef with poison, but I don't know when that will happen. We'll try to push for the poison patches soonish, but it will take time.
Anyway, thanks Sanjay for handling this :)

Mon, Nov 18, 6:39 AM · Restricted Project

Mon, Nov 11

nlopes committed rGa7244c56bdd0: docs: fix warning in LangRef parsing (authored by nlopes).
docs: fix warning in LangRef parsing
Mon, Nov 11, 2:47 AM
nlopes added a comment to D29121: [Docs] Add LangRef documention for freeze instruction.

@nlopes This is failing on the llvm-sphinx-docs buildbot, please can you take a look? http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/37793/steps/docs-llvm-html/logs/stdio

Warning, treated as error:
/home/buildbot/llvm-build-dir/llvm-sphinx-docs/llvm/src/llvm/docs/LangRef.rst:10243: WARNING: Could not lex literal_block as "llvm". Highlighting skipped.
Mon, Nov 11, 2:44 AM · Restricted Project

Wed, Nov 6

nlopes added a comment to D29011: [IR] Add Freeze instruction.

Does a ConstantExpr freeze really make sense? ConstantExprs are uniqued by the LLVMContext. So every constantexpr that has the same input ends up being the same object. Do we want that behavior do we need each freeze to be distinct?

Wed, Nov 6, 2:40 AM · Restricted Project

Tue, Nov 5

nlopes committed rG2d21068d9fa0: [Docs] Add LangRef documentation for freeze instruction (authored by nlopes).
[Docs] Add LangRef documentation for freeze instruction
Tue, Nov 5, 3:40 AM
nlopes closed D29121: [Docs] Add LangRef documention for freeze instruction.
Tue, Nov 5, 3:40 AM · Restricted Project

Sat, Nov 2

nlopes accepted D69690: [GlobalsAA] Restrict ModRef result if any internal method has its address taken..

LGTM!

Sat, Nov 2, 12:56 PM · Restricted Project

Wed, Oct 30

nlopes added a comment to D29121: [Docs] Add LangRef documention for freeze instruction.

So this is not committed till we reviewed all of them?

I'm just waiting on SelDAG->MIR patch to be done (https://reviews.llvm.org/D29014).
Then we have docs, SelDAG & MIR support. That seems the minimal to me (so the compiler won't crash when freeze is used). I agree the optimizer patches can land later.

Can I suggest that we add a stub* ISEL implementation, land this, and then build on top of it?

  • By which I mean a knowingly incorrect lowering to a simple COPY. It wouldn't fix *all* of our poison/undef problems, but it would allow us to make progress on some of the most painful IR ones while waiting for that patch to land.
Wed, Oct 30, 6:39 PM · Restricted Project

Mon, Oct 28

nlopes added a comment to D29121: [Docs] Add LangRef documention for freeze instruction.

So this is not committed till we reviewed all of them?

Mon, Oct 28, 6:18 PM · Restricted Project

Fri, Oct 25

nlopes added a comment to D69442: [CVP] prevent propagating poison when substituting edge values into a phi (PR43802).

LGTM

Fri, Oct 25, 3:43 PM · Restricted Project

Oct 20 2019

nlopes committed rL375358: add John Regehr as speaker to Alive2 talk.
add John Regehr as speaker to Alive2 talk
Oct 20 2019, 2:29 AM

Oct 16 2019

nlopes added a comment to D68342: [Analysis] Don't assume that unsigned overflow can't happen in EmitGEPOffset (PR42699).

LGTM
(there's only a typo in the comment "singned")

Oct 16 2019, 12:21 PM · Restricted Project

Oct 15 2019

nlopes added a comment to D68342: [Analysis] Don't assume that unsigned overflow can't happen in EmitGEPOffset (PR42699).

The patch looks good to me. Actually I had reported this bug a while back as well: https://bugs.llvm.org/show_bug.cgi?id=42699
I agree we can't have objects larger than half of the address space.

Oct 15 2019, 8:56 AM · Restricted Project

Oct 7 2019

nlopes updated the diff for D29121: [Docs] Add LangRef documention for freeze instruction.

Clarify semantics for pointers.

Oct 7 2019, 3:17 PM · Restricted Project

Oct 5 2019

nlopes added a comment to D29121: [Docs] Add LangRef documention for freeze instruction.

@nlopes anything holding this patch? do you intend to land them all at once?
@aqjune I suppose D29011 should be the next one up for review..

Oct 5 2019, 6:20 AM · Restricted Project

Sep 17 2019

nlopes added inline comments to D29121: [Docs] Add LangRef documention for freeze instruction.
Sep 17 2019, 6:35 AM · Restricted Project

Sep 16 2019

nlopes updated the diff for D29121: [Docs] Add LangRef documention for freeze instruction.

Made it explicit re one vs multiple calls to freeze.

Sep 16 2019, 6:45 AM · Restricted Project
nlopes added inline comments to D29121: [Docs] Add LangRef documention for freeze instruction.
Sep 16 2019, 5:25 AM · Restricted Project
nlopes updated the diff for D29121: [Docs] Add LangRef documention for freeze instruction.

Updated with an example with vectors and add more references to freeze section.

Sep 16 2019, 4:18 AM · Restricted Project
nlopes updated the diff for D29121: [Docs] Add LangRef documention for freeze instruction.

Reflect comments & clarify immediate UB when branching on poison.

Sep 16 2019, 2:23 AM · Restricted Project

Aug 31 2019

nlopes committed rL370568: add nlopes.
add nlopes
Aug 31 2019, 2:23 AM

Jul 10 2019

nlopes added a comment to D64215: Add a transform pass to make the executable semantics of poison explicit in the IR.

Just a shameless plug :)
We've been half secretly working on Alive2 (https://github.com/AliveToolkit/alive2), which includes a plugin for opt that can check if an optimization is correct or not. Alive2 also has a standalone tool that accepts 2 IR files instead.

I'd tried playing with Alive2 a while ago, and had trouble getting it to work. Could you maybe update the readme (or other docs) with some instructions on how to use the standalone tool you mentioned? I'd very much like to play with this.

I've just added a short description to the README file: https://github.com/AliveToolkit/alive2#running-standalone-translation-validation-tool-alive-tv
It's fairly simple: it just takes 2 LLVM IR files. Let me know if you have questions or if you find bugs :)

This tool implements the semantics of poison for many LLVM instructions, and already has some support for memory (which is quite hard to handle).
Of course, what this patch does is not the same. This patch is more executable, while Alive2 requires Z3 to reason about the semantics (though it can also execute code very slowly).

I'd love to explore options for sharing the semantics here. What form does Alive2 express them in?

That's still a unsolved research problem. No one really knows how to share semantics still.
The semantics in Alive2 are written in C++, using an embedded expression language. While it is potentially possible to reuse that somewhere else, it isn't trivial. See e.g. the ir/instr.cpp file.

One thought on sharing.

From what I can tell from a quick look at the code you mentioned, it looks like you're parsing IR into an expression language, then rewriting the expressions to propagate poison - in a fairly similar manner to this code, but over your expression language - and then translating that expression language to SMT. Is that a good high level summary?

Jul 10 2019, 9:43 AM · Restricted Project
nlopes added inline comments to D64451: [PoisonChecking] Validate inbounds annotation on getelementptr where possible.
Jul 10 2019, 9:34 AM · Restricted Project

Jul 9 2019

nlopes added a comment to D64215: Add a transform pass to make the executable semantics of poison explicit in the IR.

Just a shameless plug :)
We've been half secretly working on Alive2 (https://github.com/AliveToolkit/alive2), which includes a plugin for opt that can check if an optimization is correct or not. Alive2 also has a standalone tool that accepts 2 IR files instead.

I'd tried playing with Alive2 a while ago, and had trouble getting it to work. Could you maybe update the readme (or other docs) with some instructions on how to use the standalone tool you mentioned? I'd very much like to play with this.

I've just added a short description to the README file: https://github.com/AliveToolkit/alive2#running-standalone-translation-validation-tool-alive-tv
It's fairly simple: it just takes 2 LLVM IR files. Let me know if you have questions or if you find bugs :)

I finally got it working, required a couple changes to the CMakeFiles and an LD_PRELOAD (for unclear reasons). However, it doesn't look like the scope of the alive-tv tool is anywhere near wide enough for my purposes.

Correct me if I'm wrong, but it looks like it can't handle loops at all right? And use of any memory seams to trigger timeouts? (Even for trivially identical IR?) Just making sure there's no error between keyboard and chair. :)

Jul 9 2019, 12:09 PM · Restricted Project

Jul 6 2019

nlopes added a comment to D64215: Add a transform pass to make the executable semantics of poison explicit in the IR.

Just a shameless plug :)
We've been half secretly working on Alive2 (https://github.com/AliveToolkit/alive2), which includes a plugin for opt that can check if an optimization is correct or not. Alive2 also has a standalone tool that accepts 2 IR files instead.

I'd tried playing with Alive2 a while ago, and had trouble getting it to work. Could you maybe update the readme (or other docs) with some instructions on how to use the standalone tool you mentioned? I'd very much like to play with this.

Jul 6 2019, 3:37 AM · Restricted Project

Jul 5 2019

nlopes added a comment to D64215: Add a transform pass to make the executable semantics of poison explicit in the IR.

Just a shameless plug :)
We've been half secretly working on Alive2 (https://github.com/AliveToolkit/alive2), which includes a plugin for opt that can check if an optimization is correct or not. Alive2 also has a standalone tool that accepts 2 IR files instead.
This tool implements the semantics of poison for many LLVM instructions, and already has some support for memory (which is quite hard to handle).
Of course, what this patch does is not the same. This patch is more executable, while Alive2 requires Z3 to reason about the semantics (though it can also execute code very slowly).

Jul 5 2019, 6:50 AM · Restricted Project

Jun 10 2019

nlopes added a comment to D63044: [LangRef] Clarify poison semantics.

LGTM, thank you!

Jun 10 2019, 9:55 AM · Restricted Project

Jun 9 2019

nlopes added inline comments to D63044: [LangRef] Clarify poison semantics.
Jun 9 2019, 11:25 AM · Restricted Project
nlopes updated subscribers of D63044: [LangRef] Clarify poison semantics.
Jun 9 2019, 2:55 AM · Restricted Project
nlopes added a comment to D63044: [LangRef] Clarify poison semantics.

Sounds great! Just 1 comment inline.

Jun 9 2019, 2:53 AM · Restricted Project

Mar 30 2019

nlopes accepted D57983: [ConstantRange] Shl of ConstantRanges considers full-set shifting to last bit position.

LGTM.
Minor: you have a typo in the comment: "return return"

Mar 30 2019, 3:06 AM · Restricted Project

Mar 29 2019

nlopes added a comment to D57983: [ConstantRange] Shl of ConstantRanges considers full-set shifting to last bit position.

I believe the contains function I wrote is correct. It says that an integer n belongs to interval I iff n >= lower(I) and n < upper(I) is there's no wrapping.
BTW, function isWrappedSet() just changed recently, so that needs tweaking in the Z3 model I sent (https://github.com/llvm-mirror/llvm/blob/master/lib/IR/ConstantRange.cpp#L347)

Mar 29 2019, 7:42 AM · Restricted Project

Mar 3 2019

nlopes requested changes to D57983: [ConstantRange] Shl of ConstantRanges considers full-set shifting to last bit position.

This patch is not correct for this input:
lhs = FullSet
rhs = [0, 1)

Mar 3 2019, 8:14 AM · Restricted Project

Feb 6 2019

nlopes committed rL353349: move attribute inference to project to gsoc 2019.
move attribute inference to project to gsoc 2019
Feb 6 2019, 2:35 PM

Dec 31 2018

nlopes added a comment to D56155: [docs] cttz and ctlz return poison, not undef, when argument is 0.

Based on the current documentation of poison values, selecting over poison is still poison by the first rule. I'm assuming that this is an inaccuracy in the documentation and selects are treated the same ways as phis? Otherwise the cited clang code would be affected.

Dec 31 2018, 2:03 AM

Dec 30 2018

nlopes added a comment to D56155: [docs] cttz and ctlz return poison, not undef, when argument is 0.

As a justification why it doesn't matter whether it's undef or poison, clang emits__builtin_ffs as:
ffs(x) -> x ? cttz(x) + 1 : 0

Dec 30 2018, 6:44 AM

Dec 29 2018

nlopes added reviewers for D56155: [docs] cttz and ctlz return poison, not undef, when argument is 0: sanjoy, spatel.
Dec 29 2018, 3:03 PM

Dec 2 2018

nlopes committed rL348092: add our OOPLSA'18 paper.
add our OOPLSA'18 paper
Dec 2 2018, 8:00 AM

Dec 1 2018

nlopes committed rL348077: fix html.
fix html
Dec 1 2018, 7:16 AM

Nov 8 2018

nlopes added a comment to D54237: Constant folding and instcombine for saturating adds.

Regarding

// X + undef -> undef
// undef + X -> undef
if (match(Op1, m_Undef()) || match(Op0, m_Undef()))
  return UndefValue::get(ReturnType);

I was initially planning to include these simplifications, but ultimately was not certain regarding their legality. In particular, if we have uadd.sat(MaxValue, Y), then the result is fully determined to be MaxValue, regardless of the value of Y. If we have something like sadd.sat(SignedMinValue, Y) then the result is known to be negative. In either case the intrinsic cannot have the full range of results of the result type, regardless of the value of Y. As such, I think folding operations on undef to undef would not be legal in this case.

It should be possible to fold uadd.sat(X, undef) to MaxValue. Not sure how useful that is though.

Nov 8 2018, 2:41 PM

Sep 10 2018

nlopes added a comment to D51738: add IR flags to MI.

Sure, adding nsw/nuw brings in poison. I didn't study all the MI transformations going on, so I can't comment on whether this is a big burden or not, but without such a study introducing poison is dangerous.
SDAG already has nsw/nuw IIRC, though. But I don't think there was a thorough study of the implications at the time either.

Sep 10 2018, 3:14 AM

Jul 17 2018

nlopes committed rL337307: devmtg201810: add SRC PC members.
devmtg201810: add SRC PC members
Jul 17 2018, 10:55 AM

Jul 9 2018

nlopes committed rL336535: update next conf date.
update next conf date
Jul 9 2018, 3:23 AM

Jul 8 2018

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

Does this mean we can "construct" undef as:

x = alloca 0
y = alloca 0
undef = x == y  // Non-deterministically 0 or 1

? If so, this is a problem since it means even if we spec un-initialized memory as poison we still have undef in the IR (with all the problems it brings).

Jul 8 2018, 12:16 PM
nlopes added a comment to D49047: [InstCombine] fix shuffle-of-binops transform to avoid poison/undef .

BTW, I couldn't figure if this case is possible, but mentioning it just in case: it's also not legal to introduce 'sdiv undef, ..', since 'sdiv INT_MIN, -1' is UB. Same for srem. So we need to be careful when folding the shuffle on LHS as well.

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

Jul 6 2018

nlopes added inline comments to D48987: [InstCombine] drop poison flags for shuffle transforms with undefs.
Jul 6 2018, 1:12 AM

Jul 5 2018

nlopes added inline comments to D48987: [InstCombine] drop poison flags for shuffle transforms with undefs.
Jul 5 2018, 2:32 PM

Jul 4 2018

nlopes added a comment to D48893: [Constants, InstCombine] allow RHS (operand 1) identity constants for binops.

shl %x, undef is poison; we don't want more undefs :)
So this transformation for shifts is not correct. The way to make it correct would be to introduce a poison value and use it in the shuffle instructions instead of undef. I suggest we finally go ahead and do that.

  1. Does the 'undef' in the shuffle mask represent something different than the 'undef' in the shift amount?
Jul 4 2018, 3:36 PM
nlopes added a comment to D48893: [Constants, InstCombine] allow RHS (operand 1) identity constants for binops.

shl %x, undef is poison; we don't want more undefs :)
So this transformation for shifts is not correct. The way to make it correct would be to introduce a poison value and use it in the shuffle instructions instead of undef. I suggest we finally go ahead and do that.

Jul 4 2018, 1:51 AM

Jul 3 2018

nlopes accepted D48860: Make llvm.objectsize more conservative with null in non-zero address spaces.

LGTM

Jul 3 2018, 3:19 PM

Jun 17 2018

nlopes added inline comments to D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata..
Jun 17 2018, 11:27 AM · Restricted Project

Jun 12 2018

nlopes added inline comments to D48066: Add one more No-alias case to alias analysis..
Jun 12 2018, 5:57 AM
nlopes added inline comments to D48066: Add one more No-alias case to alias analysis..
Jun 12 2018, 5:39 AM
nlopes added inline comments to D47854: [LangRef] Clarify semantics of load metadata..
Jun 12 2018, 1:39 AM
nlopes added inline comments to D44748: Track whether the size of a MemoryLocation is precise.
Jun 12 2018, 1:29 AM

Jun 11 2018

nlopes added inline comments to D47854: [LangRef] Clarify semantics of load metadata..
Jun 11 2018, 3:51 AM
nlopes added inline comments to D47854: [LangRef] Clarify semantics of load metadata..
Jun 11 2018, 3:22 AM

Jun 9 2018

nlopes added inline comments to D47963: [LangRef] nnan and ninf produce poison..
Jun 9 2018, 3:05 PM

Jun 7 2018

nlopes added a comment to D47854: [LangRef] Clarify semantics of load metadata..

Yes, although hopefully align(4) would have also been specified on the function argument. As the reference must have been bound to a valid object, from C++ semantics, we should know that it's properly aligned. Do we do that now?

Jun 7 2018, 7:18 AM
nlopes added a comment to D47854: [LangRef] Clarify semantics of load metadata..

I just got a scary ah-ah moment..
Take this code:

Jun 7 2018, 7:01 AM
nlopes accepted D47851: [LangRef] fptosi and fptoui return poison on overflow..

The C++ standard defines this as UB: http://eel.is/c++draft/conv.fpint#1
"A prvalue of a floating-point type can be converted to a prvalue of an integer type. The conversion truncates; that is, the fractional part is discarded.
The behavior is undefined if the truncated value cannot be represented in the destination type."

Jun 7 2018, 6:10 AM
nlopes accepted D47859: [LangRef] insertelement/extractelement return poison for out of range..

LGTM

Jun 7 2018, 6:01 AM

Jun 5 2018

nlopes added inline comments to D47339: [GVN,NewGVN] Keep nonnull if K does not move..
Jun 5 2018, 8:12 AM
nlopes added inline comments to D47747: [LangRef] Clarify "undefined" for various instructions..
Jun 5 2018, 8:03 AM
nlopes added a comment to D47747: [LangRef] Clarify "undefined" for various instructions..

Eli, thanks a lot for kicking off the discussion. I think this patch is a bit too big since there are a few things that are not trivial.
For example, I would rather not introduce more functions returning undef, but rather return poison instead. If there's no good motivation for undef, poison should be used by default from now on, since it's much easier to handle than undef.
This patch also introduces a lot of UB with metadata tags, which is a departure from how we handle things like nsw/nuw which make the instructions yield poison instead of UB. Why is it more important to preserve nsw when hoisting an add than preserving !nonnull when hoisting a load? I really don't know; hence I'm asking.
I think it would help to split this patch a bit.

Jun 5 2018, 7:46 AM
nlopes updated subscribers of D47747: [LangRef] Clarify "undefined" for various instructions..
Jun 5 2018, 7:36 AM

Jun 4 2018

nlopes added inline comments to D47339: [GVN,NewGVN] Keep nonnull if K does not move..
Jun 4 2018, 3:02 PM
nlopes added inline comments to D47475: [Local] Make DoesKMove required for combineMetadata..
Jun 4 2018, 3:00 PM

May 28 2018

nlopes added a comment to D47339: [GVN,NewGVN] Keep nonnull if K does not move..

The optimization looks good to me.

May 28 2018, 12:11 PM

May 13 2018

nlopes committed rL332194: fix a slides link.
fix a slides link
May 13 2018, 2:24 AM

Apr 5 2018

nlopes added inline comments to D42381: [DA] Correct size parameter from dependency analysis to AA.
Apr 5 2018, 3:00 AM

Mar 31 2018

nlopes added a comment to D44748: Track whether the size of a MemoryLocation is precise.

LGTM, but I would wait for another review due to the size of the change.

Mar 31 2018, 11:30 AM

Mar 26 2018

nlopes added a comment to D44748: Track whether the size of a MemoryLocation is precise.

I like the direction in general. I've reviewed this patch and it LGTM (as well as the overall plan).
There are still a few corner cases we need to fix regarding the meaning of size -1, but I guess it's an orthogonal fix. Right now I don't know exactly what -1 size is: does it mean potentially access the whole object, or access the object from the current offset and potentially until the end?

Mar 26 2018, 12:17 PM
nlopes added a comment to D44884: Improving 'addArgumentAttrsFromCallsites' .

Please don't remove non-functional changes from this patch. It contains dozens of indentation changes which are completely unrelated with the intended change and make the review more difficult. There are also debug printfs included that need to be removed :)
This document may be useful: http://llvm.org/docs/Contributing.html

Mar 26 2018, 8:55 AM

Feb 20 2018

nlopes committed rL325638: open projects gsoc'18: add function attribute inference idea.
open projects gsoc'18: add function attribute inference idea
Feb 20 2018, 3:00 PM
nlopes committed rL325636: open projects: move LLVM gsoc'18 projects out od LLDB section.
open projects: move LLVM gsoc'18 projects out od LLDB section
Feb 20 2018, 2:43 PM

Feb 18 2018

nlopes added a comment to D43269: [MemorySSA] Be less aggressive with @llvm.lifetime.start.

Thanks @dberlin and @george.burgess.iv. I wasn't aware of this issue.

Feb 18 2018, 2:54 PM
nlopes added a comment to D43269: [MemorySSA] Be less aggressive with @llvm.lifetime.start.

Given that the original motivation for these lifetime intrinsincs was for inlining, I don't see a reason to support multiple start/ends on the same pointer.
Or is there another new use case that I'm unaware of? Also, we don't have any transformation splitting (or even shrinking I think) these lifetimes.

Feb 18 2018, 8:07 AM

Feb 11 2018

nlopes added a comment to D43141: [DAG] make binops with undef operands consistent with IR.

oh, wow, so many bugs in DAG combiner handling undef.. Nice table btw!

Feb 11 2018, 4:36 AM

Jan 17 2018

nlopes added a comment to D41944: [LLVM][IR][LIT] support of 'no-overflow' flag for sdiv\udiv instructions.

Before accepting this patch, we really need to see benchmark results. I'm not going to change clang to start emitting non-UB divs if the perf is going to be horrible. We need data.
Otherwise I don't see the need for this poison version of division. Could you elaborate if your plan is to expose this somehow to the application developer?

I'm sorry if this questions have been properly answered in the past. If so, could you please link them here?

In general the proposed feature allows compiler to start speculating div without worrying too much of div-by-zero etc. so for example you can do instruction hoisting or vectorizing predicated sdiv.
We are currently focused on vectorizing predicated div instruction and our implementation shows around 20-30% improvements on several tests of coremark-pro and denbench.

Jan 17 2018, 9:40 AM
nlopes added a comment to D41944: [LLVM][IR][LIT] support of 'no-overflow' flag for sdiv\udiv instructions.

Before accepting this patch, we really need to see benchmark results. I'm not going to change clang to start emitting non-UB divs if the perf is going to be horrible. We need data.
Otherwise I don't see the need for this poison version of division. Could you elaborate if your plan is to expose this somehow to the application developer?

Jan 17 2018, 8:53 AM

Dec 13 2017

nlopes added a comment to D40670: Let Alloca treated as nonnull for any alloca addr space value.

How about introduce nullptr value for each addr space in data layout? E.g., assume alloca addr space is 3 and nullptr value of addr space 3 is -1. alloca of addr space 3 could return 0, but never return -1.

Then this code

if (isa<AllocaInst>(V) && Q.DL.getAllocaAddrSpace() == 0)

can be changed as

if (isa<AllocaInst>(V) && Q.DL.getAllocaNullPointerValue() == 0)

This assumes that alloca never returns nullptr value.

Nuno, Sean, will this work for you?

Thanks.

Sorry for the delay.
What if a target doesn't have an invalid pointer? This is not uncommon in embedded ISAs.

I don't particularly like the idea of mixing null pointers (which we define as having the value zero ATM), alloca not being able to return a null pointer, and the possibility of changing the value of null pointers to a non-zero value.

How about adding a hook TargetTransformInfo::isAllocaPtrValueNonZero which returns true if alloca inst value is always non-zero.

The drawback is that some ValueTracking functions will depend on TargetTransformInfo. As a result, those passes using ValueTrackign will require TargetTransformInfo.

What do you think?

Thanks.

Dec 13 2017, 3:18 PM

Dec 12 2017

nlopes added a comment to D40670: Let Alloca treated as nonnull for any alloca addr space value.

How about introduce nullptr value for each addr space in data layout? E.g., assume alloca addr space is 3 and nullptr value of addr space 3 is -1. alloca of addr space 3 could return 0, but never return -1.

Then this code

if (isa<AllocaInst>(V) && Q.DL.getAllocaAddrSpace() == 0)

can be changed as

if (isa<AllocaInst>(V) && Q.DL.getAllocaNullPointerValue() == 0)

This assumes that alloca never returns nullptr value.

Nuno, Sean, will this work for you?

Thanks.

Dec 12 2017, 7:27 AM

Nov 30 2017

nlopes requested changes to D40670: Let Alloca treated as nonnull for any alloca addr space value.

This change is incorrect. null can be a valid pointer in a non-0 address space, and alloca may return it.
If your target's address space guarantees that alloca doesn't return null, then we can probably make this target-dependent. But we cannot simply make it unconditional; that's not correct.

Nov 30 2017, 2:32 PM

Nov 28 2017

nlopes resigned from D20375: [PM] Port Bounds-Checking to the new pass manager.
Nov 28 2017, 6:35 AM

Nov 23 2017

nlopes added a comment to D38569: Expose must/may alias info in MemorySSA..

An immediate usecase I have in LICM, is in very large testcases where I want to rely on MemorySSA's threshhold for optimizing MemUses.
I need to use getDefiningAccess() on a Use and query if the result given is May_Alias or Must_Alias. If the Use is not optimized, the result will always be MayAlias. If optimized, it may be May or Must.
Alias info is needed to avoid an additional AA.alias call when creating mssa alias sets for promotion.

It can certainly be used for more complex optimizations, aliasing between MemDefs is the most interesting to me. Since in MemorySSA all stores clobber all stores (until optimized), must alias info could be used to shortcut def alias chains. AFAIK this is done for MemUses, I don't think it's done for MemDefs.

Nov 23 2017, 5:21 AM
nlopes added inline comments to D38862: Add must alias info to ModRefInfo..
Nov 23 2017, 2:58 AM
nlopes added inline comments to D38862: Add must alias info to ModRefInfo..
Nov 23 2017, 2:56 AM

Nov 22 2017

nlopes added a comment to D39417: InstCombine: Preserve nuw when reassociating nuw ops [1/3].

This patch LGTM, except for the changes in tryFactorization(). It seems there's some code missing.

Nov 22 2017, 10:51 AM
nlopes added a comment to D38569: Expose must/may alias info in MemorySSA..

The concept looks interesting to me. I'll let the experts review the patch, though (I just skimmed over it).
Out of curiosity, what are the clients you envision could use this functionality?
I can imagine that we can do store forwarding with a mustalias MemUse if stored size >= load size. Also, a mustalias MemDef can kill the previous MemDef if it has no other uses (2 stores to same location).
Are there any other uses cases? Can it be used to simplify more complex optimizations? Even better, are there missing blocks that would be needed to simplify these optimizations? (tricky question; just wondering if you have some thoughts on that).

Nov 22 2017, 9:43 AM

Nov 21 2017

nlopes committed rL318786: removed unused private method decl. NFC.
removed unused private method decl. NFC
Nov 21 2017, 9:56 AM

Nov 9 2017

nlopes committed rL317815: revert r317812 [BasicAA] fix build break by converting the previously….
revert r317812 [BasicAA] fix build break by converting the previously…
Nov 9 2017, 9:35 AM
nlopes committed rL317812: [BasicAA] fix build break by converting the previously introduced assert into….
[BasicAA] fix build break by converting the previously introduced assert into…
Nov 9 2017, 9:06 AM
nlopes committed rL317803: [BasicAA] add assertion for corner case in aliasGEP().
[BasicAA] add assertion for corner case in aliasGEP()
Nov 9 2017, 8:17 AM

Nov 8 2017

nlopes committed rL317680: BasicAA: fix bug where we would return partialalias instead of noalias.
BasicAA: fix bug where we would return partialalias instead of noalias
Nov 8 2017, 2:59 AM

Oct 28 2017

nlopes committed rL316838: [pubs.js] add poison paper.
[pubs.js] add poison paper
Oct 28 2017, 12:30 PM

Sep 21 2017

nlopes added a comment to D37832: Eliminate PHI (int typed) which is only used by inttoptr.

Ok, mea culpa, I thought CreateBitOrPointerCast() would simply create a bitcast.
Then, what we have here is:

v = phi(ptr2int(p), ptr2int(q))
 =>
v = ptr2int(phi(p, q))
Sep 21 2017, 8:35 AM

Sep 20 2017

nlopes added a comment to D37832: Eliminate PHI (int typed) which is only used by inttoptr.

As I have mentioned, this patch itself does *not* fold any ptrtoint/inttoptr. It simply moves the intptr across the phi node. The folding you see with the test cases is done by existing optimizations, so I am not sure what the objection is about.

Sep 20 2017, 3:56 AM

Sep 19 2017

nlopes added a comment to D37832: Eliminate PHI (int typed) which is only used by inttoptr.

Ok, so after another scan through the patch and a discussion with Gil, I must say the transformation is not fully correct.

Sep 19 2017, 6:24 AM