lebedev.ri (Roman Lebedev)
User

Projects

User does not belong to any projects.

User Details

User Since
Oct 27 2012, 6:35 AM (298 w, 1 d)

Recent Activity

Today

lebedev.ri updated the diff for D49348: Harden/relax clang/test/CodeGen/opt-record-MIR.c test.

Simplify regex even more.

Sun, Jul 15, 1:00 PM
lebedev.ri created D49348: Harden/relax clang/test/CodeGen/opt-record-MIR.c test.
Sun, Jul 15, 12:35 PM
lebedev.ri added inline comments to D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Sun, Jul 15, 10:10 AM
lebedev.ri added a comment to D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Sun, Jul 15, 9:57 AM
lebedev.ri added a comment to D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.

Just a few nits - otherwise, LGTM.

Sun, Jul 15, 9:57 AM
lebedev.ri added a comment to D49310: [llvm-mca][BtVer2] Teach how to identify dependency-breaking idioms..

Can you add a comment to the end of the btver sched profile, that X86MCInstrAnalysis::isDependencyBreaking()
is also responsible (as in, needs to be modified) in detection of dep-breaking patterns?

If the goal is to document this behavior, a comment in the class MCInstrAnalysis should be enough.
If the goal is to provide guidelines for people that want to use llvm-mca, then we should have all this features documented in a .rst file.

The goal is to spare time of whoever will be adding some new scheduling model by explaining that the X86MCInstrAnalysis::isDependencyBreaking() needs to be modified too, for mca to be able to properly handle these dependency-breaking idioms.

Sun, Jul 15, 3:55 AM

Yesterday

lebedev.ri added a comment to D47681: [DAGCombiner] Bug 31275- Extract a shift from a constant mul or udiv if a rotate can be formed.

It seems everyone else is busy with other differentials, and don't have time to spare to review this :/

Sat, Jul 14, 7:38 AM
lebedev.ri added a comment to D45444: [clang-tidy] implement new check for const-correctness.

Ping, i guess :)
Anything needed to get this going?

Sat, Jul 14, 7:34 AM
lebedev.ri added a comment to D48222: Check Sched Class tables at generation time - 2.

Nice! Some nits.

Sat, Jul 14, 7:33 AM
lebedev.ri added a comment to D47637: Check Sched Class tables at generation time.

Anything to do to get this going? Or did this got replaced by some other differential? D48222?

Sat, Jul 14, 7:14 AM
lebedev.ri requested changes to D46380: [InstSimplify] Adding safety checks for 'shl', 'ashr' and 'lshr'.

(Removing from my review queue for the time being.)

Sat, Jul 14, 7:13 AM
lebedev.ri added a reviewer for D48828: [InstSimplify] fold extracting from std::pair: lebedev.ri.

The InstSimplify change needs it's own test set in test/Transforms/InstSimplify.

Sat, Jul 14, 7:11 AM
lebedev.ri added inline comments to D49248: [TargetLowering] Add support for non-uniform vectors to BuildUDIV.
Sat, Jul 14, 6:52 AM
lebedev.ri added a comment to D48789: [X86] Replace (32/64 - n) shift amounts with (neg n) since the shift amount is masked in hardware.

Other than nits i have no further comments, thanks.

Sat, Jul 14, 6:48 AM
lebedev.ri added inline comments to D49248: [TargetLowering] Add support for non-uniform vectors to BuildUDIV.
Sat, Jul 14, 6:30 AM
lebedev.ri accepted D49270: [InstCombine] Preserve debug value when simplifying cast-of-select.

I would prefer some more general solution, but this does not look awful, too.
You probably want to wait a bit in case others want to comment.

Sat, Jul 14, 6:23 AM
lebedev.ri added inline comments to D49196: [llvm-mca][BtVer2] teach how to identify false dependencies on partially written registers..
Sat, Jul 14, 6:19 AM
lebedev.ri added a comment to D49310: [llvm-mca][BtVer2] Teach how to identify dependency-breaking idioms..

Can you add a comment to the end of the btver sched profile, that X86MCInstrAnalysis::isDependencyBreaking()
is also responsible (as in, needs to be modified) in detection of dep-breaking patterns?

Sat, Jul 14, 5:49 AM

Fri, Jul 13

lebedev.ri updated the summary of D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:07 PM
lebedev.ri added 1 commit(s) for D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern: rL337042: [NFC][InstCombine] Tests for 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:07 PM
lebedev.ri added an edge to rL337042: [NFC][InstCombine] Tests for 'check for [no] signed truncation' pattern: D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:07 PM
lebedev.ri added a dependency for D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern: D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:06 PM
lebedev.ri added a dependent revision for D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern: D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:06 PM
lebedev.ri created D49320: [InstCombine] Fold 'check for [no] signed truncation' pattern.
Fri, Jul 13, 2:06 PM
lebedev.ri updated the diff for D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.

Added all the sane negative tests.
Other than the one-use question i think this is ready for the review.

Fri, Jul 13, 9:32 AM
lebedev.ri accepted D49268: [clang-doc] Create a script to generate tests.

I have no further comments here.
I assume this works as intended; if not, since it is mainly a developer-only tool, further issues could be addressed later on.

Fri, Jul 13, 9:27 AM · Restricted Project
lebedev.ri added an edge to rL337014: [NFC][X86][AArch64] Negative tests for 'check for [no] signed truncation'…: D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern.
Fri, Jul 13, 9:20 AM
lebedev.ri added 1 commit(s) for D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern: rL337014: [NFC][X86][AArch64] Negative tests for 'check for [no] signed truncation'….
Fri, Jul 13, 9:20 AM
lebedev.ri added inline comments to D49243: [X86] Improved sched models for X86 BT*rr instructions.
Fri, Jul 13, 8:03 AM
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Well, that's just great, with isCastPartOfExplictCast(), the ASTContext::getParents()
also does not return CXXStaticCastExpr as parent for such cases.
I don't know how to proceed.

Fri, Jul 13, 7:18 AM · Restricted Project
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Address @vsk review notes, although this will be revered by the next update dropping the faulty 'stack' optimization.

Fri, Jul 13, 6:10 AM · Restricted Project
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

@vsk so yeah, no wonder that doesn't work.
Somehow in that test case ScalarExprEmitter::VisitExplicitCastExpr() never gets called.
(I'm pretty sure this worked with the naive implementation, so worst case i'll just revert the 'stack' code)
Trying to assess the issue..

Fri, Jul 13, 5:42 AM · Restricted Project
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
In D48958#1160848, @vsk wrote:

<...>
The stage2 build traps before it finishes:

FAILED: lib/IR/AttributesCompatFunc.inc.tmp
cd /Users/vsk/src/builds/llvm.org-lldbsan-stage2-R/tools/clang/stage2-bins && /Users/vsk/src/builds/llvm.org-lldbsan-stage2-R/tools/clang/stage2-bins/bin/llvm-tblgen -gen-attrs -I /Users/vsk/src/llvm.org-lldbsan/llvm/lib/IR -I /Users/vsk/src/llvm.org-lldbsan/llvm/include /Users/vsk/src/llvm.org-lldbsan/llvm/lib/IR/AttributesCompatFunc.td -o lib/IR/AttributesCompatFunc.inc.tmp -d lib/IR/AttributesCompatFunc.inc.d
/Users/vsk/src/llvm.org-lldbsan/llvm/include/llvm/ADT/DenseMap.h:732:66: runtime error: implicit cast from type 'uint64_t' (aka 'unsigned long long') of value 4294967296 (64-bit, unsigned) to type 'unsigned int' changed the value to 0 (32-bit, unsigned)
/bin/sh: line 1: 96848 Abort trap: 6

This looks like a false positive to me. It's complaining about static_cast<unsigned>(NextPowerOf2(...)), but the static_cast is explicit.

Good to know, so the stack-based logic for ExplicitCastExpr detection needs further tests/refinements..

Fri, Jul 13, 3:57 AM · Restricted Project
lebedev.ri added a comment to D49268: [clang-doc] Create a script to generate tests.

Nice!
Some comments.
Sorry about lack of the review, this kinda fell off my radar.

Fri, Jul 13, 1:48 AM · Restricted Project
lebedev.ri updated the diff for D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.

Address both test regressions with one fix - new TargetLowering hook.
FIXME: is there something preexising that i could use? I did look, and didn't find any..

Fri, Jul 13, 12:55 AM

Thu, Jul 12

lebedev.ri added a comment to D49270: [InstCombine] Preserve debug value when simplifying cast-of-select.

Judging by the pattern, i would almost guess every single transform in instcombine will need such a fix?
Can this be generalized somehow, fixing the outer place which actually applies replacements?

Thu, Jul 12, 11:14 PM
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
In D48958#1160848, @vsk wrote:
In D48958#1160479, @vsk wrote:

Thank you for taking a look!

In D48958#1160381, @vsk wrote:

I have some minor comments but overall I think this is in good shape. It would be great to see some compile-time numbers just to make sure this is tractable. I'm pretty sure -fsanitize=null would fire more often across a codebase than this check, so I don't anticipate a big surprise here.

Could you please clarify, which numbers are you looking for, specifically?
The time it takes to build llvm stage2 with -fsanitize=implicit-cast?
Or the time it takes to build llvm stage3 with compiler built with -fsanitize=implicit-cast?

I had in mind measuring the difference between -fsanitize=undefined and -fsanitize=undefined,implicit-cast, with a stage2 compiler. I think that captures the expected use case: existing ubsan users enabling this new check.

FWIW, i'm trying to look into optimizing these new IR patterns right now D49179 D49247.

(The numbers won't be too representable, whole stage-1 takes ~40 minutes here...)

Ah I see, I'll run a few builds and take a stab at it, then.

Yes, please, thank you!

The stage2 build traps before it finishes:

FAILED: lib/IR/AttributesCompatFunc.inc.tmp
cd /Users/vsk/src/builds/llvm.org-lldbsan-stage2-R/tools/clang/stage2-bins && /Users/vsk/src/builds/llvm.org-lldbsan-stage2-R/tools/clang/stage2-bins/bin/llvm-tblgen -gen-attrs -I /Users/vsk/src/llvm.org-lldbsan/llvm/lib/IR -I /Users/vsk/src/llvm.org-lldbsan/llvm/include /Users/vsk/src/llvm.org-lldbsan/llvm/lib/IR/AttributesCompatFunc.td -o lib/IR/AttributesCompatFunc.inc.tmp -d lib/IR/AttributesCompatFunc.inc.d
/Users/vsk/src/llvm.org-lldbsan/llvm/include/llvm/ADT/DenseMap.h:732:66: runtime error: implicit cast from type 'uint64_t' (aka 'unsigned long long') of value 4294967296 (64-bit, unsigned) to type 'unsigned int' changed the value to 0 (32-bit, unsigned)
/bin/sh: line 1: 96848 Abort trap: 6

This looks like a false positive to me. It's complaining about static_cast<unsigned>(NextPowerOf2(...)), but the static_cast is explicit.

Thu, Jul 12, 2:36 PM · Restricted Project
lebedev.ri added inline comments to D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Thu, Jul 12, 2:27 PM
lebedev.ri updated the diff for D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.

Actually run $ ninja check-llvm this time, two tests regressed..

Thu, Jul 12, 2:03 PM
lebedev.ri added a dependency for D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern: D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern.
Thu, Jul 12, 1:54 PM
lebedev.ri added a dependent revision for D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern: D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Thu, Jul 12, 1:54 PM
lebedev.ri created D49266: [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern.
Thu, Jul 12, 1:53 PM
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
In D48958#1160479, @vsk wrote:

Thank you for taking a look!

In D48958#1160381, @vsk wrote:

I have some minor comments but overall I think this is in good shape. It would be great to see some compile-time numbers just to make sure this is tractable. I'm pretty sure -fsanitize=null would fire more often across a codebase than this check, so I don't anticipate a big surprise here.

Could you please clarify, which numbers are you looking for, specifically?
The time it takes to build llvm stage2 with -fsanitize=implicit-cast?
Or the time it takes to build llvm stage3 with compiler built with -fsanitize=implicit-cast?

I had in mind measuring the difference between -fsanitize=undefined and -fsanitize=undefined,implicit-cast, with a stage2 compiler. I think that captures the expected use case: existing ubsan users enabling this new check.

FWIW, i'm trying to look into optimizing these new IR patterns right now D49179 D49247.

(The numbers won't be too representable, whole stage-1 takes ~40 minutes here...)

Ah I see, I'll run a few builds and take a stab at it, then.

Thu, Jul 12, 11:07 AM · Restricted Project
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Thank you for taking a look!

Thu, Jul 12, 10:42 AM · Restricted Project
lebedev.ri added inline comments to D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern.
Thu, Jul 12, 9:56 AM
lebedev.ri updated the diff for D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern.

nounwind, fix some function names.

Thu, Jul 12, 9:56 AM
lebedev.ri created D49247: [NFC][X86][AArch64] Add tests for the 'check for [no] signed truncation' pattern.
Thu, Jul 12, 9:22 AM
lebedev.ri added inline comments to D49242: [Intrinsics] define funnel shift IR intrinsics + DAG builder support.
Thu, Jul 12, 9:10 AM
lebedev.ri accepted D49243: [X86] Improved sched models for X86 BT*rr instructions.

In general, looks good to me, but probably wait for someone else to review, too.

Thu, Jul 12, 9:01 AM
lebedev.ri added inline comments to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Thu, Jul 12, 8:01 AM
lebedev.ri added a comment to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

Filed https://bugs.llvm.org/show_bug.cgi?id=38149 to track the signed part of the pattern.

Thu, Jul 12, 7:47 AM
lebedev.ri added a comment to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

LGTM.

Thank you for such speedy review!

I'm wondering, what about the signed case?
https://godbolt.org/g/WvWX13
https://godbolt.org/g/DM7XA4
https://rise4fun.com/Alive/Qslx (check that 25 high bits are either all-ones, or all-zeros)

Can we do this in instcombine?
Or not, given that we were disabling some bit-fiddling transforms lately?

Actually, not sure that is any better, will leave that for now.
Though the reverse transform might be a good thing for dagcombine.

It's a good question, but probably better asked on the dev list than here. I think we prefer to canonicalize to the form with less instructions even if that means we lose information from the eliminated ops.

For future reference, here is a more straight-forward fold https://rise4fun.com/Alive/XuW, that will afterwards fold back into and+icmp https://godbolt.org/g/bm3yZu
But any such fold will clearly need dagcombine work, since the 'naive' version with shifts seems to produce optimal assembly already.
So after all i'm not sure i'm motivated to look into the 'signed truncation pattern' right now..

Name: signed truncation check
  %old0 = shl i16 %x, 8
  %old1 = ashr exact i16 %old0, 8
  %ret = icmp eq i16 %old1, %x
=>
  %new0 = icmp slt i16 %x, 128
  %new1 = icmp sgt i16 %x, -129
  %ret = and i1 %new1, %new0

Name: and-of-icmps
  %new0 = icmp slt i16 %x, 128
  %new1 = icmp sgt i16 %x, -129
  %ret = and i1 %new1, %new0
=>
  %x.off = add i16 %x, 128
  %ret = icmp ult i16 %x.off, 256

Let me make sure I'm seeing it - as a question of IR canonicalization, we're deciding which of these 3 forms is best?

Not really. I agree that the last one is the best from IR clarity standpoint.
I was just looking for some other variants of this pattern.
(Sadly souper was of no help here, strangely.)

Thu, Jul 12, 7:29 AM
lebedev.ri added a comment to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

LGTM.

Thank you for such speedy review!

I'm wondering, what about the signed case?
https://godbolt.org/g/WvWX13
https://godbolt.org/g/DM7XA4
https://rise4fun.com/Alive/Qslx (check that 25 high bits are either all-ones, or all-zeros)

Can we do this in instcombine?
Or not, given that we were disabling some bit-fiddling transforms lately?

Actually, not sure that is any better, will leave that for now.
Though the reverse transform might be a good thing for dagcombine.

It's a good question, but probably better asked on the dev list than here. I think we prefer to canonicalize to the form with less instructions even if that means we lose information from the eliminated ops.

Thu, Jul 12, 6:57 AM
lebedev.ri added a comment to D49205: [InstCombine] Fold x & (-1 >> y) != x to x u> (-1 >> y).

LGTM

Thank you for the review.

Thu, Jul 12, 6:41 AM
lebedev.ri added a reviewer for D49229: [InstCombine] Fold redundant masking operations of shifted value: lebedev.ri.

Would be good if you could also put these folds into https://rise4fun.com/Alive and link them here,
to validate that at least the cases tested here are handled correctly.

Thu, Jul 12, 5:53 AM
lebedev.ri added inline comments to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
Thu, Jul 12, 3:58 AM · Restricted Project
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Address @vsk's review notes.

  • Maintain the stack of currently-being-visited CastExpr's
  • Use that stack to check whether we are in a ExplicitCastExpr
  • Move logic for deciding whether to emit the check out of EmitScalarConversion()
  • Condense all overloads of EmitScalarConversion() down to one.
Thu, Jul 12, 3:58 AM · Restricted Project

Wed, Jul 11

lebedev.ri added inline comments to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 3:40 PM
lebedev.ri added 2 commit(s) for D48756: [gold-plugin] Disable section ordering for relocatable links: rL336838: gold: Add ability to toggle function/data sections, rL336858: Temporarily reverting..
Wed, Jul 11, 3:30 PM
lebedev.ri added an edge to rL336858: Temporarily reverting.: D48756: [gold-plugin] Disable section ordering for relocatable links.
Wed, Jul 11, 3:30 PM
lebedev.ri added an edge to rL336838: gold: Add ability to toggle function/data sections: D48756: [gold-plugin] Disable section ordering for relocatable links.
Wed, Jul 11, 3:30 PM
lebedev.ri retitled D48756: [gold-plugin] Disable section ordering for relocatable links from Add option for section ordering to [gold-plugin] Add option for section ordering.
Wed, Jul 11, 3:28 PM
lebedev.ri added a dependent revision for D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) : D49205: [InstCombine] Fold x & (-1 >> y) != x to x u> (-1 >> y).
Wed, Jul 11, 2:38 PM
lebedev.ri added a dependency for D49205: [InstCombine] Fold x & (-1 >> y) != x to x u> (-1 >> y): D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 2:38 PM
lebedev.ri created D49205: [InstCombine] Fold x & (-1 >> y) != x to x u> (-1 >> y).
Wed, Jul 11, 2:38 PM
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Add some more tricky tests where maintaining just the CastExpr part of AST stack would break them.

Wed, Jul 11, 2:12 PM · Restricted Project
lebedev.ri added inline comments to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
Wed, Jul 11, 2:08 PM · Restricted Project
lebedev.ri added a dependency for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part: D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 12:14 PM · Restricted Project
lebedev.ri added a dependent revision for D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) : D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
Wed, Jul 11, 12:14 PM
lebedev.ri added a comment to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

LGTM.

Thank you for such speedy review!

I'm wondering, what about the signed case?
https://godbolt.org/g/WvWX13
https://godbolt.org/g/DM7XA4
https://rise4fun.com/Alive/Qslx (check that 25 high bits are either all-ones, or all-zeros)

Can we do this in instcombine?
Or not, given that we were disabling some bit-fiddling transforms lately?

Wed, Jul 11, 11:01 AM
lebedev.ri added a comment to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

LGTM.

Wed, Jul 11, 10:01 AM
lebedev.ri added inline comments to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 8:53 AM
lebedev.ri updated the diff for D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .

Address @spatel's review notes.

Wed, Jul 11, 8:53 AM
lebedev.ri added inline comments to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 6:30 AM
lebedev.ri added a comment to D48222: Check Sched Class tables at generation time - 2.

@lebedev.ri What do you reckon we should do to fix the WriteShiftDouble warnings?

Wed, Jul 11, 6:20 AM
lebedev.ri added inline comments to D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 6:08 AM
lebedev.ri created D49179: [InstCombine] Fold x & (-1 >> y) == x to x u<= (-1 >> y) .
Wed, Jul 11, 6:04 AM

Tue, Jul 10

lebedev.ri added inline comments to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
Tue, Jul 10, 2:51 PM · Restricted Project
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

@vsk thank you for taking a look!

Tue, Jul 10, 2:07 PM · Restricted Project
lebedev.ri added inline comments to D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part.
Tue, Jul 10, 12:59 PM · Restricted Project
lebedev.ri updated the diff for D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part.
  • Drop indeed-unneeded 'grouping' ImplicitCast check. For some reason i was very sure i just didn't add some macro, and there was grouping at this level, too.
  • Added test with runtime blacklist, doubling as a test for -fno-sanitize-recover= test
Tue, Jul 10, 12:59 PM · Restricted Project
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
  • Check that sanitizer is actually enabled before doing the AST upwalk. I didn't measure, but it would be logical for this to be better.
Tue, Jul 10, 12:59 PM · Restricted Project
lebedev.ri added a comment to D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

Finished running it on a normal testset of my pet project.

  • It fired ~18 times.
  • There were no obvious false-positives (e.g. when an explicit cast was involved).
  • At least 3 of those appear to be a true bugs.
  • 4-5 more are probably bugs, but it is hard to tell.
  • Last 10-11 appear to be mostly OK intentional truncating casts.
Tue, Jul 10, 2:54 AM · Restricted Project

Mon, Jul 9

lebedev.ri added inline comments to D49040: [SLC] Simplify pow(x, 0.333...) to cbrt(x).
Mon, Jul 9, 12:13 PM
lebedev.ri added a comment to D48768: [X86] When have BMI2, prefer shifts to clear low/high bits, rather than variable mask..

This looks like the right default for x86 based on size of the code and opportunities for other combines (and as noted, it's what we would have produced anyway until very recently), so LGTM.

Mon, Jul 9, 11:48 AM
lebedev.ri updated subscribers of D47903: [OpenMP] Use C++11 Atomics - barrier, tasking, and lock code.

Hello.
This broke the build:

$ ninja
[0/17] Performing build step for 'libcxx_fuzzer_x86_64'
ninja: no work to do.
[2/17] Building CXX object projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o
FAILED: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o 
/usr/bin/clang++-6.0  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Domp_EXPORTS -Iprojects/openmp/runtime/src -I/build/openmp/runtime/src -I/usr/include/libxml2 -Iinclude -I/build/llvm/include -I/build/openmp/runtime/src/i18n -I/build/openmp/runtime/src/include/50 -I/build/openmp/runtime/src/thirdparty/ittnotify -g0 -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Werror -std=c++11 -O3 -g0  -fPIC   -UNDEBUG -D _GNU_SOURCE -D _REENTRANT -fno-exceptions -fno-rtti -Wno-sign-compare -Wno-unused-function -Wno-unused-local-typedef -Wno-unused-value -Wno-unused-variable -Wno-switch -Wno-covered-switch-default -Wno-deprecated-register -Wno-gnu-anonymous-struct -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-missing-braces -Wno-comment -Wno-self-assign -Wno-vla-extension -Wno-format-pedantic -MD -MT projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o -MF projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o.d -o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o -c /build/openmp/runtime/src/kmp_wait_release.cpp
In file included from /build/openmp/runtime/src/kmp_wait_release.cpp:14:
/build/openmp/runtime/src/kmp_wait_release.h:175:29: error: cast from 'volatile void *' to 'void *' drops volatile qualifier [-Werror,-Wcast-qual]
    KMP_FSYNC_SPIN_ACQUIRED(spin);
                            ^
/build/openmp/runtime/src/kmp_wait_release.h:346:28: error: cast from 'volatile void *' to 'void *' drops volatile qualifier [-Werror,-Wcast-qual]
    KMP_FSYNC_SPIN_PREPARE(spin);
                           ^
/build/openmp/runtime/src/kmp_wait_release.h:453:27: error: cast from 'volatile void *' to 'void *' drops volatile qualifier [-Werror,-Wcast-qual]
  KMP_FSYNC_SPIN_ACQUIRED(spin);
                          ^
/build/openmp/runtime/src/kmp_wait_release.h:175:29: error: cast from 'volatile void *' to 'void *' drops volatile qualifier [-Werror,-Wcast-qual]
    KMP_FSYNC_SPIN_ACQUIRED(spin);
                            ^

and several more pages of this.
If this can't be fixed soon (a hour?), *please* revert.

Mon, Jul 9, 11:24 AM · Restricted Project
lebedev.ri added inline comments to D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part.
Mon, Jul 9, 7:33 AM · Restricted Project
lebedev.ri changed the visibility for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.
Mon, Jul 9, 7:27 AM · Restricted Project
lebedev.ri changed the visibility for D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part.
Mon, Jul 9, 7:27 AM · Restricted Project
lebedev.ri updated the diff for D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part.

C and C++ are interesting languages. They are statically typed, but weakly.
The implicit conversions are allowed. This is nice, allows to write code
while balancing between getting drowned in everything being convertible,
and nothing being convertible. As usual, this comes with a price:

Mon, Jul 9, 7:27 AM · Restricted Project
lebedev.ri updated the diff for D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part.

This is a compiler-rt part.
The clang part is D48958.

Mon, Jul 9, 7:27 AM · Restricted Project

Sun, Jul 8

lebedev.ri updated the diff for D49015: [X86][Nearly NFC] Split SHLD/SHRD into their own WriteShiftDouble class.

Rebased, NFC.

Sun, Jul 8, 11:44 AM
lebedev.ri added a comment to D48789: [X86] Replace (32/64 - n) shift amounts with (neg n) since the shift amount is masked in hardware.

Can you rebase this since D48767 has landed?
I think those might be affected by the patch.

Sun, Jul 8, 10:49 AM
lebedev.ri added inline comments to D48936: [X86][SSE] Prefer BLEND(SHL(v,c1),SHL(v,c2)) over MUL(v, c3).
Sun, Jul 8, 9:46 AM
lebedev.ri added a comment to D48768: [X86] When have BMI2, prefer shifts to clear low/high bits, rather than variable mask..

Ping?

Sun, Jul 8, 9:38 AM
lebedev.ri added inline comments to D49015: [X86][Nearly NFC] Split SHLD/SHRD into their own WriteShiftDouble class.
Sun, Jul 8, 2:43 AM
lebedev.ri added a comment to D48997: [MCA][X86][NFC] Add BSF/BSR resource tests.

LGTM

Sun, Jul 8, 2:18 AM

Sat, Jul 7

lebedev.ri updated the diff for D36836: [clang-tidy] Implement sonarsource-function-cognitive-complexity check.

Rebased, just to control bitrot, no changes.

Sat, Jul 7, 6:32 AM · Restricted Project
lebedev.ri updated the diff for D36892: [clang-tidy] check_clang_tidy.py: support CHECK-NOTES prefix.

Rebased, just to control bitrot, no changes.

Sat, Jul 7, 6:32 AM · Restricted Project

Fri, Jul 6

lebedev.ri added a comment to D47474: Implement cpu_dispatch/cpu_specific Multiversioning.

Some drive-by nits.
General observation: this is kinda large.
I would personally split split off the codegen part into a second patch.

Fri, Jul 6, 3:17 PM