Page MenuHomePhabricator

kpn (Kevin P. Neal)
User

Projects

User does not belong to any projects.

User Details

User Since
Feb 20 2018, 9:31 AM (227 w, 2 d)

Recent Activity

Tue, Jun 28

kpn updated the diff for D118392: [SCCP][FuncSpec] Switch away from Instruction::isSafeToRemove().

Move more of Instruction::isSafeToRemove() into this function. The remainder of isSafeToRemove() isn't needed because we filter out function calls at the top of the changed function.

Tue, Jun 28, 12:11 PM · Restricted Project, Restricted Project
kpn added a comment to D115737: [IPSCCP] Partial support for constrained intrinsics.

Ping

Tue, Jun 28, 9:25 AM · Restricted Project, Restricted Project

Mon, Jun 20

kpn added a comment to D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2.

Ping

Mon, Jun 20, 9:09 AM · Restricted Project, Restricted Project

Thu, Jun 16

kpn updated the diff for D115737: [IPSCCP] Partial support for constrained intrinsics.

Update for review comments. I've also reduced it down to just fcmp and fcmps having a functional impact. I don't have a good way to test the binary operators just yet.

Thu, Jun 16, 11:48 AM · Restricted Project, Restricted Project
kpn committed rG1f331224fb17: [strictfp][IPSCCP] Precommit tests for D115737. (authored by kpn).
[strictfp][IPSCCP] Precommit tests for D115737.
Thu, Jun 16, 8:24 AM · Restricted Project, Restricted Project

Mon, Jun 6

kpn committed rGa1f1bd547b0d: [IPSCCP] Switch away from Instruction::isSafeToRemove() (authored by kpn).
[IPSCCP] Switch away from Instruction::isSafeToRemove()
Mon, Jun 6, 6:24 AM · Restricted Project, Restricted Project
kpn closed D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().
Mon, Jun 6, 6:24 AM · Restricted Project, Restricted Project
kpn updated the diff for D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2.

Rebase.

Mon, Jun 6, 6:19 AM · Restricted Project, Restricted Project

Fri, Jun 3

kpn added reviewers for D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2: darkbuck, asbirlea, Tyker, spatel, reames, sanjoy.
Fri, Jun 3, 12:53 PM · Restricted Project, Restricted Project

Jun 1 2022

kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

Update comment as requested.

Jun 1 2022, 10:08 AM · Restricted Project, Restricted Project
kpn added a comment to D126364: Fix interaction of pragma FENV_ACCESS with other pragmas.

On targets that support static rounding mode (like RISCV) dynamic and constant rounding modes may be different and the behavior changes if default mode is replaced by dynamic.

Whether a target supports static rounding modes on floating-point instructions is completely irrelevant. The user-visible behavior must be the same either way. If a target doesn't have specialized instructions, the code generator can save/restore the rounding mode. This should be transparent to the user; the user can't read the rounding mode in between the save and restore. (We already do this sort of rounding mode manipulation on x86, to implement float-to-int conversion on targets without SSE.)

Jun 1 2022, 6:42 AM · Restricted Project, Restricted Project

May 31 2022

kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

Update for review comments: eliminate unneeded checks.

May 31 2022, 11:38 AM · Restricted Project, Restricted Project

May 25 2022

kpn added inline comments to D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().
May 25 2022, 11:03 AM · Restricted Project, Restricted Project

May 24 2022

kpn added a comment to D125899: [ADT] Add copy constructor to IntervalMap.

I've verified that it fixes the build on FreeBSD 11.1 and the current version of FreeBSD 12.

May 24 2022, 3:40 PM · Restricted Project, Restricted Project

May 23 2022

kpn added a comment to D125899: [ADT] Add copy constructor to IntervalMap.

Will this fix FreeBSD 12 (and maybe 11?). FreeBSD 12 is still very much supported.

May 23 2022, 6:30 AM · Restricted Project, Restricted Project

May 13 2022

kpn added a comment to D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2.

Ping.

May 13 2022, 11:01 AM · Restricted Project, Restricted Project

May 3 2022

kpn added inline comments to D118426: [InstCombine] Remove side effect of replaced constrained intrinsics.
May 3 2022, 5:34 AM · Restricted Project, Restricted Project

May 2 2022

kpn added inline comments to D118426: [InstCombine] Remove side effect of replaced constrained intrinsics.
May 2 2022, 10:45 AM · Restricted Project, Restricted Project

Apr 26 2022

kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

Update for review comments.

Apr 26 2022, 12:07 PM · Restricted Project, Restricted Project

Apr 21 2022

kpn added inline comments to D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().
Apr 21 2022, 9:37 AM · Restricted Project, Restricted Project

Apr 19 2022

kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

Update for review comments.

Apr 19 2022, 11:29 AM · Restricted Project, Restricted Project
kpn retitled D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove() from [NFC][IPSCCP] Switch away from Instruction::isSafeToRemove() to [IPSCCP] Switch away from Instruction::isSafeToRemove().
Apr 19 2022, 11:28 AM · Restricted Project, Restricted Project
kpn added a comment to D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

I realized that going through isInstructionTriviallyDead() means it will handle constrained intrinsics differently than it does now. So this isn't strictly speaking an NFC change.

Apr 19 2022, 11:28 AM · Restricted Project, Restricted Project
kpn abandoned D69616: [FPEnv] The inliner shouldn't mix strictfp and non-strictfp functions..

Not needed anymore after D69798 landed.

Apr 19 2022, 11:22 AM · Restricted Project, Restricted Project

Apr 14 2022

kpn committed rGd43d9e1d5c98: [FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X (authored by kpn).
[FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X
Apr 14 2022, 8:49 AM · Restricted Project, Restricted Project
kpn closed D123396: [FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X.
Apr 14 2022, 8:49 AM · Restricted Project, Restricted Project

Apr 12 2022

kpn accepted D118259: [AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL.

I trust you on the instruction set changes. LGTM.

Apr 12 2022, 10:36 AM · Restricted Project, Restricted Project

Apr 8 2022

kpn requested review of D123396: [FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X.
Apr 8 2022, 8:52 AM · Restricted Project, Restricted Project

Apr 5 2022

kpn updated the diff for D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2.

Rebase.

Apr 5 2022, 10:42 AM · Restricted Project, Restricted Project
kpn added a reviewer for D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2: bkramer.
Apr 5 2022, 10:40 AM · Restricted Project, Restricted Project

Mar 25 2022

kpn added a comment to D69798: Implement inlining of strictfp functions.

I had forgotten that this patch never landed, but I was investigating a bug yesterday that I think this will help with (https://github.com/llvm/llvm-project/issues/48669).

@kpn are you happy with the current form. It's gotten stale in a few places, but I think it's basically correct.

Mar 25 2022, 11:15 AM · Restricted Project, Restricted Project

Mar 21 2022

kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

Rebase. Ping.

Mar 21 2022, 10:52 AM · Restricted Project, Restricted Project
Herald added a project to D118392: [SCCP][FuncSpec] Switch away from Instruction::isSafeToRemove(): Restricted Project.

Ping.

Mar 21 2022, 10:51 AM · Restricted Project, Restricted Project

Mar 18 2022

kpn committed rGbd050a34febb: [FPEnv][InstSimplify] Teach CannotBeNegativeZero() about constrained intrinsics. (authored by kpn).
[FPEnv][InstSimplify] Teach CannotBeNegativeZero() about constrained intrinsics.
Mar 18 2022, 7:25 AM · Restricted Project
kpn closed D121483: [FPEnv][InstSimplify] Teach CannotBeNegativeZero() about constrained intrinsics..
Mar 18 2022, 7:25 AM · Restricted Project, Restricted Project

Mar 17 2022

kpn committed rGae6db2f3d849: Precommit test for D121483: (authored by kpn).
Precommit test for D121483:
Mar 17 2022, 12:03 PM · Restricted Project
kpn added a comment to D118259: [AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL.

It's been a while, but I think the aarch64-neon-intrinsics-constrained.c test is trimmed down from the aarch64-neon-intrinsics.c test. Shouldn't the constrained and non-constrained end-to-end tests be treated the same?

Are you referring to https://github.com/llvm/llvm-project/blob/main/clang/test/CodeGen/aarch64-neon-intrinsics.c? This one doesn't check assembly.

Mar 17 2022, 7:16 AM · Restricted Project, Restricted Project
kpn added a comment to D118259: [AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL.

It's been a while, but I think the aarch64-neon-intrinsics-constrained.c test is trimmed down from the aarch64-neon-intrinsics.c test. Shouldn't the constrained and non-constrained end-to-end tests be treated the same?

Mar 17 2022, 6:54 AM · Restricted Project, Restricted Project

Mar 11 2022

kpn requested review of D121483: [FPEnv][InstSimplify] Teach CannotBeNegativeZero() about constrained intrinsics..
Mar 11 2022, 11:46 AM · Restricted Project, Restricted Project

Feb 22 2022

kpn added a comment to D118426: [InstCombine] Remove side effect of replaced constrained intrinsics.

It seems like these dangling, useless instructions would interfere with subsequent optimizations until finally they might or might not get removed here. And constant folding isn't sufficient to duplicate the logic of the transform pass that determined the instruction could be deleted.

InstCombine is called several times, it calls constant folding and instruction simplification functions. It looks like a good place to get rid of such useless instructions.

Feb 22 2022, 11:57 AM · Restricted Project, Restricted Project
kpn added a comment to D118426: [InstCombine] Remove side effect of replaced constrained intrinsics.

I'm still not clear on why, when a transform pass knows an instruction can be deleted, we are required to keep that instruction around anyway. It seems like these dangling, useless instructions would interfere with subsequent optimizations until finally they might or might not get removed here. And constant folding isn't sufficient to duplicate the logic of the transform pass that determined the instruction could be deleted.

Feb 22 2022, 5:18 AM · Restricted Project, Restricted Project

Feb 16 2022

kpn accepted D111437: [SystemZ/z/OS] Implement GOFF writer for empty files.

Please wait a couple of days in case there are any comments from anyone else.

Feb 16 2022, 10:48 AM · Restricted Project
kpn committed rGdb7eb9c108d0: Add an include that is required on some hosts. This should fix the bot (authored by kpn).
Add an include that is required on some hosts. This should fix the bot
Feb 16 2022, 10:11 AM
kpn committed rG8290f2535ba0: [FPEnv][FMF] Move helper function to header, move fast math flags to new… (authored by kpn).
[FPEnv][FMF] Move helper function to header, move fast math flags to new…
Feb 16 2022, 9:35 AM
kpn closed D119752: [FPEnv][FMF] Move helper function to header, move fast math flags to new include file..
Feb 16 2022, 9:35 AM · Restricted Project
kpn committed rGc7400892caa0: [FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0 (authored by kpn).
[FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0
Feb 16 2022, 7:10 AM
kpn closed D119746: [FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0.
Feb 16 2022, 7:10 AM · Restricted Project
kpn added a comment to D64746: Add constrained intrinsics for lrint and lround.

This matches my understanding. (Though I must admit I'm not 100% confident I fully understand the precise distinction between "undefined behavior", a poison value, and an undef value ... It's certainly one of those :-) But from my reading of the IR reference, "poison" does indeed look correct here.)

OK, thank you!
It's poison. UB would be too strong. I've put on my todo list to fix LangRef as well.

The reason why I was hesitating about poison vs. UB is exceptions. This is clearer when talking about the exception metadata as opposed to the rounding mode metadata: if exception metadata promises that FP exceptions are disabled, but they are actually enabled at runtime, compiler optimizations are free to generate code triggering spurious exceptions that might kill the program outright - that seems more like UB than poison to me.

With the rounding mode, this is much less obvious to me, but I guess in theory it could happen that if the actual rounding mode does not match the mode promised by the metadata, a compiler optimization might possibly generate code that could now e.g. introduce an underflow where the unoptimized code would not have one, and if in addition exception are also enabled, that extra underflow could now trigger an extra exception. However, I'm not sure if that can actually ever occur in practice ...

Thank you!
Makes sense. I need to think a bit more about this.
Ideally we want to allow intrinsics marked as not throwing exceptions to be executed speculatively. The semantics needs to be crafted to allow that scenario.
I think returning poison for the rounding mode is OK as that is sufficient to trigger an exception (as poison can be replaced with any value). So we can keep the mismatch in rounding modes as poison. And then move the complexity to the exception semantics. It's not obvious to me what's the ideal semantics yet.

Feb 16 2022, 5:17 AM · Restricted Project

Feb 14 2022

kpn updated the diff for D119752: [FPEnv][FMF] Move helper function to header, move fast math flags to new include file..

Remove unneeded includes, and correct the placement of the include of FMF.h.

Feb 14 2022, 12:33 PM · Restricted Project
kpn requested review of D119752: [FPEnv][FMF] Move helper function to header, move fast math flags to new include file..
Feb 14 2022, 11:37 AM · Restricted Project
kpn requested review of D119746: [FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0.
Feb 14 2022, 10:58 AM · Restricted Project
kpn committed rG22bd65fbe7ec: [FPEnv][InstSimplify] Fold fsub X, +0 ==> X (authored by kpn).
[FPEnv][InstSimplify] Fold fsub X, +0 ==> X
Feb 14 2022, 8:57 AM
kpn closed D118928: [FPEnv][InstSimplify] Fold fsub X, +0 ==> X.
Feb 14 2022, 8:57 AM · Restricted Project

Feb 10 2022

kpn added a comment to D111437: [SystemZ/z/OS] Implement GOFF writer for empty files.

More comments about the implementation?
E.g. is the name flags_t acceptable?

Feb 10 2022, 1:08 PM · Restricted Project
kpn updated the diff for D118928: [FPEnv][InstSimplify] Fold fsub X, +0 ==> X.

Update for review comments: don't fold away a case that can and should result in -0.0. Add tests for this very case.

Feb 10 2022, 10:15 AM · Restricted Project

Feb 3 2022

kpn requested review of D118928: [FPEnv][InstSimplify] Fold fsub X, +0 ==> X.
Feb 3 2022, 11:13 AM · Restricted Project

Feb 1 2022

kpn accepted D110322: [ConstantFolding] Fold constrained compare intrinsics.

LGTM

Feb 1 2022, 11:39 AM · Restricted Project
kpn updated the diff for D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().

No, actually wouldInstructionBeTriviallyDead() rejects some instructions that the previous isSafeToRemove() function allowed. By trusting a true returned by wouldInstructionBeTriviallyDead(), but using the old logic if it returned false, we can make this change NFC. To that end I have also removed the constrained FP logic and I plan on adding it back in probably D115737.

Feb 1 2022, 7:16 AM · Restricted Project, Restricted Project

Jan 28 2022

kpn added inline comments to D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().
Jan 28 2022, 9:08 AM · Restricted Project, Restricted Project

Jan 27 2022

kpn added a comment to D118319: Pass for fixing dependencies of constrained intrinsics.

I think it would be better to do this as part of InstCombine. I don't think having a single pass at the end of the pipeline would be a good solution to this, as it means that these dead calls will survive through most of the optimization pipeline, blocking cost models and other optimizations. This doesn't look expensive enough that including it in InstCombine would be a problem.

Jan 27 2022, 9:27 AM · Restricted Project
kpn requested review of D118392: [SCCP][FuncSpec] Switch away from Instruction::isSafeToRemove().
Jan 27 2022, 9:22 AM · Restricted Project, Restricted Project
kpn retitled D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove() from [U to [IPSCCP] Switch away from Instruction::isSafeToRemove().
Jan 27 2022, 9:17 AM · Restricted Project, Restricted Project
kpn requested review of D118387: [IPSCCP] Switch away from Instruction::isSafeToRemove().
Jan 27 2022, 9:11 AM · Restricted Project, Restricted Project

Jan 5 2022

kpn added a comment to D116694: [RISCV] Add strictfp support for compares..

In IRBuilder.h we have this:

Jan 5 2022, 3:07 PM · Restricted Project

Dec 21 2021

kpn added a comment to D115804: [CodeGen] use saturating FP casts when compiling with "no-strict-float-cast-overflow".

What's the plan for constrained intrinsics versions of these intrinsics? The IRBuilder calls for CreateFPToSI and CreateFPToUI are strict FP aware, but this new code isn't.

Not sure. cc'ing @kpn @sepavloff @andrew.w.kaylor
The saturating intrinsics implement non-standard behavior for C languages AFAIK, so we might want to warn if someone tries to use "-fno-strict-float-cast-overflow" and "-ffp-exception-behavior=strict" at the same time? Or we try to support that corner case by adding even more FP intrinsics?

Conversion float->int depends on rounding mode. At least on some ML cores this conversion is made with saturating semantics. So ability to specify rounding mode would be useful for such targets.

Dec 21 2021, 10:35 AM · Restricted Project

Dec 15 2021

kpn added inline comments to D110322: [ConstantFolding] Fold constrained compare intrinsics.
Dec 15 2021, 9:16 AM · Restricted Project
kpn added a comment to D110322: [ConstantFolding] Fold constrained compare intrinsics.

My guess:

Dec 15 2021, 8:43 AM · Restricted Project

Dec 14 2021

kpn requested review of D115737: [IPSCCP] Partial support for constrained intrinsics.
Dec 14 2021, 8:33 AM · Restricted Project, Restricted Project

Dec 6 2021

kpn added a comment to D115131: [Support] [Debuginfod] Move HTTPClient to Debuginfod library..

I don't see how this will resolve my issue. I'll start a new thread on llvm-dev. Don't let me block this review.

Dec 6 2021, 12:46 PM · Restricted Project
kpn added a comment to D115131: [Support] [Debuginfod] Move HTTPClient to Debuginfod library..

BTW, for a future ticket: having curl enabled without first checking to see if it is installed creates builds failures on non-Linux hosts. OK, yes, it can be disabled with a cmake argument, but it would be better if the extra cmake argument wasn't needed. A warning at cmake configure time that says what features will be missing without curl is probably a good idea as well.

Dec 6 2021, 8:58 AM · Restricted Project

Dec 2 2021

kpn added a comment to D114946: [AArch64] Add instruction selection for strict FP.

That flag tells front ends that strictfp will generate correct instructions. Don't set it if more work is needed for correct instructions. The support should at least have parity with X86 and SystemZ.

Dec 2 2021, 10:53 AM · Restricted Project

Dec 1 2021

kpn added a comment to D114766: If constrained intrinsic is replaced, remove its side effect.

Marking as changes requested per above comment -- really don't think this is the right place to address this, since it will just create an incorrect picture of what LLVM can optimize in practice. Usually, this fold will happen via InstCombine rather than InstSimplifyPass. But I don't think changing InstCombine is the right solution either, as any number of passes do this kind of "simplify and DCE" pattern.

Dec 1 2021, 10:04 AM · Restricted Project, Restricted Project

Nov 30 2021

kpn added a comment to D114766: If constrained intrinsic is replaced, remove its side effect.

Probably the pass should run earlier, it is hard to reason without analyzing practical cases. If it is indeed so, we could move the pass or run it several times. Tuning pipeline is not unique for constant folding only. But without ability to remove instructions many optimizations do not make sense.

Nov 30 2021, 9:09 AM · Restricted Project, Restricted Project
kpn added a comment to D114766: If constrained intrinsic is replaced, remove its side effect.

Moving this logic to wouldInstructionBeTriviallyDead() does not seem right, because the decision about removing side effect comes from constant evaluation and not from the state of call object.

I'm sympathetic to this argument. If a transformation pass determines that a constrained intrinsic can be removed then it would be helpful if that pass could note that fact. This doesn't help us with analysis passes, though. And I'm a little worried about having to explicitly mark constrained intrinsics as removable since I don't know that we do that for any other instruction. If constrained intrinsics are the only time we do this then it seems error prone. Maybe I'm wrong?

The ability to remove side effect is vital for the implementation of floating point arithmetic. There are several possible optimization techniques, which depend on this possibility. For example, if FP operations in a function have attributes "round.dynamic" and "fpexcept.ignore" and we know that rounding mode is not changed in this function, we could remove side effect of all the operations, which can give performance of non-constrained operations. As we cannot mix ordinary and constrained operation in the same function, the only way is to control side effect.

We aren't saying that the ocean isn't full of water, we are only saying that you are looking at the pond while thinking it's an ocean.
We are talking about different things here. Fixing InstSimplify pass will not do any good, because it's effectively not used.

Nov 30 2021, 8:25 AM · Restricted Project, Restricted Project
kpn added a comment to D114766: If constrained intrinsic is replaced, remove its side effect.

Moving this logic to wouldInstructionBeTriviallyDead() does not seem right, because the decision about removing side effect comes from constant evaluation and not from the state of call object.

Nov 30 2021, 7:54 AM · Restricted Project, Restricted Project
kpn added a comment to D114766: If constrained intrinsic is replaced, remove its side effect.

Well, the problem is more widespread than that. IPSCCP can create instructions where it knows the result, and it knows the instruction will never trap. Consider how it can propagate two constants into a compare instruction. It knows the values are constants, it knows they are not undef, poison, NaN, Inf, it knows the value of the compare, and it uses that knowledge to further propagate constants and simplify the code. But it can't remove the constrained compare instruction because we don't have a good way to tell it the instruction has no side effects. It does call Instruction::isSafeToRemove(), and it does _not_ call wouldInstructionBeTriviallyDead(). A more centralized approach would be helpful.

Nov 30 2021, 7:45 AM · Restricted Project, Restricted Project

Oct 25 2021

kpn added inline comments to D111437: [SystemZ/z/OS] Implement GOFF writer for empty files.
Oct 25 2021, 10:30 AM · Restricted Project

Oct 21 2021

kpn abandoned D105895: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics.

Replaced with D112256. This patch here has restrictions that are not needed. To avoid confusing reading I'm replacing the review.

Oct 21 2021, 11:53 AM · Restricted Project
kpn requested review of D112256: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics, take 2.
Oct 21 2021, 11:50 AM · Restricted Project, Restricted Project

Oct 15 2021

kpn planned changes to D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd.

Everything that can be tested is now pushed in other tickets. I'll keep this around as a reminder to come back when m_FSub() is updated, but it doesn't need any action from anyone right now.

Oct 15 2021, 11:35 AM · Restricted Project
kpn planned changes to D105895: [FPEnv][EarlyCSE] Add support for CSE of constrained FP intrinsics.

OK, this is overkill per Andy's comment. I'll update.

Oct 15 2021, 11:30 AM · Restricted Project

Oct 14 2021

kpn committed rG727a891ec8c4: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0 (authored by kpn).
[FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0
Oct 14 2021, 9:33 AM
kpn closed D111450: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0.
Oct 14 2021, 9:33 AM · Restricted Project

Oct 13 2021

kpn updated the diff for D111450: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0.

As requested, add tests for rounding to negative infinity, exceptions ignored, no sized zeros fast math flag.

Oct 13 2021, 10:08 AM · Restricted Project
kpn added inline comments to D111450: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0.
Oct 13 2021, 10:05 AM · Restricted Project
kpn added inline comments to D111437: [SystemZ/z/OS] Implement GOFF writer for empty files.
Oct 13 2021, 6:52 AM · Restricted Project

Oct 12 2021

kpn updated the diff for D107285: [FPEnv][InstSimplify] Enable more folds for constrained fsub.

Update for review comments.

Oct 12 2021, 11:18 AM · Restricted Project
kpn committed rGbdf6ba2d30a0: [FPEnv][InstSimplify] Precommit tests: Enable more folds for constrained fsub (authored by kpn).
[FPEnv][InstSimplify] Precommit tests: Enable more folds for constrained fsub
Oct 12 2021, 10:48 AM

Oct 11 2021

kpn added inline comments to D111437: [SystemZ/z/OS] Implement GOFF writer for empty files.
Oct 11 2021, 1:04 PM · Restricted Project

Oct 8 2021

kpn requested review of D111450: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0.
Oct 8 2021, 11:38 AM · Restricted Project

Oct 7 2021

kpn committed rG97c231666a94: [NFC] Rename functions to match our naming scheme. (authored by kpn).
[NFC] Rename functions to match our naming scheme.
Oct 7 2021, 11:13 AM

Oct 6 2021

kpn committed rGf86c930cc967: [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X (authored by kpn).
[FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X
Oct 6 2021, 10:53 AM
kpn closed D111085: [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X.
Oct 6 2021, 10:52 AM · Restricted Project
kpn added inline comments to D111085: [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X.
Oct 6 2021, 8:58 AM · Restricted Project
kpn added inline comments to D111085: [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X.
Oct 6 2021, 8:13 AM · Restricted Project

Oct 4 2021

kpn requested review of D111085: [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X.
Oct 4 2021, 11:50 AM · Restricted Project
kpn committed rG770c57898e12: [FPEnv][InstSimplify] Prepush more tests for D106362. (authored by kpn).
[FPEnv][InstSimplify] Prepush more tests for D106362.
Oct 4 2021, 10:49 AM

Sep 30 2021

kpn added a comment to D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd.

As for llvm langref, I think the following statement is cited here: https://llvm.org/docs/LangRef.html#floating-point-environment:

The default LLVM floating-point environment assumes that floating-point instructions do not have side effects. Results assume the round-to-nearest rounding mode. No floating-point exception state is maintained in this environment. Therefore, there is no attempt to create or preserve invalid operation (SNaN) or division-by-zero exceptions.

This sentence is about exceptions but not the results of operations. So actually nothing in the langref justifies this transformation.

The wording could be made more explicit, but as I suggested in my comment from Aug 6 in this review: the default LLVM FP env ignores exceptions, so citing the IEEE-754 clause that begins with "under default exception handling" to describe SNAN->QNAN behavior is not applicable.

This is peculiarities of IEEE-754 language. Exception handling in this context is what to do if exceptional situation occurs. In 7.1 there is a description of the default exception handling:

This clause also specifies default non-stop exception handling for exception signals, which is to deliver a
default result, continue execution, and raise the corresponding status flag (except in the case of exact
underflow, see 7.5).

This is exactly the way the exceptions are handled in the default FP environment. Exception must be handled in some way because hardware always signals them if exceptional situation occurs.

Sep 30 2021, 10:29 AM · Restricted Project

Sep 29 2021

kpn added a comment to D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd.

Changing the way the existing transforms check for FMF.noNaNs() sounds like a different ticket that needs to be done before this one can progress. Unless I misunderstood?

I know nothing about such change.

Your proposed changes around SNaN will affect the non-constrained cases.

I think the optimization fadd X, -0 ==> X in general case (not FMF.noNaNs()) is incorrect. The obtained values must be identical to what would produce hardware, otherwise it is not an optimization. If you think that such change deserves a separate patch, no problem. It seems to me that this patch could establish correct folding even if it changes non-constrained operation as well.

Sep 29 2021, 12:13 PM · Restricted Project
kpn added a reviewer for D106362: [FPEnv][InstSimplify] Enable more folds for constrained fadd: jcranmer.
Sep 29 2021, 11:50 AM · Restricted Project