Page MenuHomePhabricator

majnemer (David Majnemer)
User

Projects

User does not belong to any projects.

User Details

User Since
Apr 15 2013, 2:02 AM (475 w, 4 d)

Recent Activity

Feb 10 2022

majnemer added a comment to D119391: [X86] Only force FP usage in the presence of pushf/popf on Win64.

Is there a test which uses flags.read with an alloca to ensure that we obey the redzone rules?

Feb 10 2022, 11:21 AM · Restricted Project

Jan 20 2022

majnemer added a comment to D117569: Constexpr not supported with __declspec(dllimport)..

Your example is different from mine as it nests the constexpr variable inside the function rather than having it at translation-unit scope.

Jan 20 2022, 3:54 PM · Restricted Project
majnemer added a comment to D117569: Constexpr not supported with __declspec(dllimport)..

I have a question regarding how this work with respect to the dllimport semantics known by the linker.
IIUC, we will now allow a program like:

extern int __declspec(dllimport) dll_import_int;
constexpr int& dll_import_constexpr_ref = dll_import_int;
int& get() {
    return dll_import_constexpr_ref;
}

Here, get will load dll_import_constexpr_ref. However, what will dll_import_constexpr_ref hold? It ought to hold the contents of __imp_?dll_import_int@@3HA. However, we can't dereference __imp_?dll_import_int@@3HA to get to its contents.

@majnemer Thanks for the review.

This test case doesn't link with MSVC. It will generate this error:
Microsoft (R) Incremental Linker Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test1.exe
test1.obj
test1.obj : error LNK2001: unresolved external symbol "int dll_import_int" (?dll_import_int@@3HA)
test1.exe : fatal error LNK1120: 1 unresolved externals

The symbols generated with MSVC are:
07 00000000 UNDEF notype External | ?dll_import_int@@3HA (int dll_import_int)
015 00000000 SECT6 notype Static | ?dll_import_constexpr_ref@@3AEAHEA (int & dll_import_constexpr_ref)

Without this patch this test case errors. With this patch clang will generate these symbols:

010 00000000 UNDEF notype External | imp_?dll_import_int@@3HA (declspec(dllimport) int dll_import_int)
012 00000000 SECT5 notype External | ?dll_import_constexpr_ref@@3AEAHEA (int & dll_import_constexpr_ref)
013 00000000 UNDEF notype External | ?dll_import_int@@3HA (int dll_import_int)

and will error at link time with this error:
test1-f1f63b.o : error LNK2019: unresolved external symbol "declspec(dllimport) int dll_import_int" (imp_?dll_import_int@@3HA) referenced in function "int & __cdecl get(void)" (?get@@YAAEAHXZ)
test1-f1f63b.o : error LNK2001: unresolved external symbol "int dll_import_int" (?dll_import_int@@3HA)
a.exe : fatal error LNK1120: 2 unresolved externals

I think that's the behavior expected, right?

Jan 20 2022, 11:45 AM · Restricted Project

Jan 19 2022

majnemer added inline comments to D117569: Constexpr not supported with __declspec(dllimport)..
Jan 19 2022, 10:31 PM · Restricted Project
majnemer added inline comments to D117569: Constexpr not supported with __declspec(dllimport)..
Jan 19 2022, 10:23 PM · Restricted Project
majnemer requested changes to D117569: Constexpr not supported with __declspec(dllimport)..

I have a question regarding how this work with respect to the dllimport semantics known by the linker.
IIUC, we will now allow a program like:

extern int __declspec(dllimport) dll_import_int;
constexpr int& dll_import_constexpr_ref = dll_import_int;
int& get() {
    return dll_import_constexpr_ref;
}
Jan 19 2022, 10:18 PM · Restricted Project

Jan 13 2022

majnemer committed rG072e2a7c67b7: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI (authored by momo5502).
[MS] Implement on-demand TLS initialization for Microsoft CXX ABI
Jan 13 2022, 9:24 PM
majnemer closed D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.
Jan 13 2022, 9:24 PM · Restricted Project

Jan 12 2022

majnemer retitled D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI from Implement on-demand TLS initialization for Microsoft CXX ABI to [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.
Jan 12 2022, 6:24 PM · Restricted Project
majnemer accepted D116338: Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms..

LGTM

Jan 12 2022, 1:25 PM · Restricted Project

Jan 11 2022

majnemer added a comment to D116338: Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms..

Do we also need to test for __aarch64__? https://developer.arm.com/documentation/dui0774/g/chr1383660321827 says that __arm__ is only defined for 32-bit targets.

Jan 11 2022, 11:47 PM · Restricted Project

Jan 3 2022

majnemer accepted D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.

Looks great! Please give others some time to review it as it is a holiday season...

Jan 3 2022, 3:13 PM · Restricted Project
majnemer added a comment to D116020: [clang][#52782] Bail on incomplete parameter type in stdcall name mangling.

I wonder if we should have different behavior for MSVC targets.

Jan 3 2022, 3:10 PM · Restricted Project
majnemer added a comment to D114425: [clang] Add __builtin_bswap128.

OOC, how hard would it be to generalize this builtin a little? It is nice that we have builtins like __builtin_add_overflow which do the right thing regardless of their input.

It seems like it would be nice if we started to expose more intrinsics which did the right thing regardless of operand width; another bonus is that it composes well with language features like _BitInt.

IMHO such builtins are nice iff the programmer can be 100% sure that the compiler will interpret them the same way as a human reader. __builtin_add_overflow is easy because its first two arguments are "mathematical integers" (where integer promotion doesn't matter) and its third argument is a pointer (where integer promotion can't happen). So you can really throw any combination of types at it, and it'll do "the right thing" https://godbolt.org/z/sa7b894oa (although I admit I was surprised that this worked).
For a hypothetical __builtin_bswap, you would probably need a similar pointer-based interface like

short s16 = 0xFEDC;
__builtin_bswap(&s16);  // hypothetically
assert(s16 == 0xDCFE);

assert(__builtin_bswap16(s16) == 0x0000DCFE);
assert(__builtin_bswap32(s16) == 0xDCFEFFFF);  // the problem to solve: s16 eagerly promotes to int, which changes the result

The downside is that the pointer-based interface is less ergonomic than today's value-based signatures, and probably worse codegen at -O0 (because the programmer has to materialize the operand into a named variable, and then the compiler won't remove that variable because you might want to debug it). The upside (as you said) is that a generic builtin could work with _ExtInt types and so on.

Jan 3 2022, 10:24 AM · Restricted Project, Restricted Project
majnemer added a comment to D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.

This is looking great! Just a few more questions.

What is the behavior with something like:

thread_local int x = 2;
int f() {
  return x;
}

I'm wondering if we need to move this logic into the generic C++ ABI implementation.

The MS compiler only emits the dynamic initializers for variables with constructors/destructors, just like it is currently done here for the Itanium ABI.
I also thought about adopting that behaviour, but I think threre are edge-cases when triggering dynamic TLS initialization even for constant variables is useful.
For example there might be custom TLS callbacks that can affect the value of this variable.

If desired, I can change it to match the behaviour of MS, but I thought it could be beneficial to diverge in this case.

Jan 3 2022, 10:16 AM · Restricted Project

Jan 2 2022

majnemer added a comment to D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.

This is looking great! Just a few more questions.

Jan 2 2022, 8:05 PM · Restricted Project
majnemer added a comment to D114425: [clang] Add __builtin_bswap128.

OOC, how hard would it be to generalize this builtin a little? It is nice that we have builtins like __builtin_add_overflow which do the right thing regardless of their input.

Jan 2 2022, 7:10 PM · Restricted Project, Restricted Project

Dec 24 2021

majnemer added inline comments to D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.
Dec 24 2021, 8:51 PM · Restricted Project

Dec 16 2021

majnemer added a comment to D115456: [MS] Implement on-demand TLS initialization for Microsoft CXX ABI.

Is this a new feature in MSVC? Seems like it might be. If so, should it be predicated on isCompatibleWithMSVC(1925) or something?

Dec 16 2021, 12:16 PM · Restricted Project

Sep 21 2021

majnemer added inline comments to D102817: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 2.
Sep 21 2021, 10:18 AM · Restricted Project, Restricted Project
majnemer accepted D109988: Teach InstCombine to eliminate malloc-realloc-free triplets..

LGTM

Sep 21 2021, 9:57 AM · Restricted Project

Jul 8 2021

majnemer added inline comments to D105672: [SimpleLoopUnswitch] Don't non-trivially unswitch loops with catchswitch exits.
Jul 8 2021, 9:33 PM · Restricted Project
majnemer requested changes to D105672: [SimpleLoopUnswitch] Don't non-trivially unswitch loops with catchswitch exits.
Jul 8 2021, 7:21 PM · Restricted Project

Jun 9 2021

majnemer added inline comments to D93470: [VP] Binary floating-point intrinsics..
Jun 9 2021, 12:02 AM · Restricted Project, Restricted Project

Jun 7 2021

majnemer added inline comments to D93470: [VP] Binary floating-point intrinsics..
Jun 7 2021, 12:19 AM · Restricted Project, Restricted Project

May 13 2021

majnemer accepted D102413: [MC] Add the ability to pass MCRegisterInfo to dump_pretty.

LGTM

May 13 2021, 1:30 PM · Restricted Project

Dec 7 2020

majnemer added inline comments to D92766: [XCOFF][AIX] Emit EH information in traceback table.
Dec 7 2020, 10:56 AM · Restricted Project

Dec 4 2020

majnemer added a comment to D92695: [X86ISelLowering] don't emit frame pointers for eflags intrinsics..

It is difficult remembering exactly what my thought process was way back when but the redzone calculation seems very likely...

Dec 4 2020, 5:21 PM · Restricted Project

Nov 19 2020

majnemer accepted D91313: Add MachineModuleInfo constructor with external MCContext.

LGTM

Nov 19 2020, 5:41 PM · Restricted Project

Oct 31 2020

majnemer added inline comments to D89628: Fix constant-folding of overflowing arithmetic ops on vectors.
Oct 31 2020, 9:27 AM · Restricted Project

Oct 30 2020

majnemer added inline comments to D88905: [Clang] Allow "ext_vector_type" applied to Booleans.
Oct 30 2020, 3:13 PM · Restricted Project, Restricted Project

Aug 12 2020

majnemer accepted D85839: [InstCombine] Fix incorrect Modified status.

LGTM

Aug 12 2020, 1:16 PM · Restricted Project

Jul 30 2020

majnemer accepted D84896: [MC] Fix memory leak when allocating MCInst with bump allocator.

LGTM

Jul 30 2020, 11:02 AM · Restricted Project

Jul 8 2020

majnemer added inline comments to D83360: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X.
Jul 8 2020, 2:31 PM · Restricted Project, Restricted Project

Jun 3 2020

majnemer added inline comments to D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1.
Jun 3 2020, 6:45 PM · Restricted Project, Restricted Project, Restricted Project

May 14 2020

majnemer added inline comments to D76077: [ARM] Add __bf16 as new Bfloat16 C Type.
May 14 2020, 8:38 AM · Restricted Project

May 13 2020

majnemer accepted D79474: [Windows EH] Fix the order of Nested try-catches in $tryMap$ table.

LGTM

May 13 2020, 1:03 PM · Restricted Project

May 6 2020

majnemer added inline comments to D79474: [Windows EH] Fix the order of Nested try-catches in $tryMap$ table.
May 6 2020, 1:00 PM · Restricted Project

Apr 13 2020

majnemer accepted D77897: [SVE] Remove calls to getBitWidth from IR.

LGTM

Apr 13 2020, 5:25 PM · Restricted Project
majnemer accepted D78047: [AntiDepBreaker][NFC] Move AntiDepBreaker.h to include folder.

LGTM

Apr 13 2020, 4:20 PM · Restricted Project

Apr 11 2020

majnemer added a comment to D77777: [nvptx] Add `nvvm.texsurf.handle` internalizer..
In D77777#1975406, @tra wrote:

the 1st argument in llvm.nvvm.texsurf.hande.internal or the 2nd one in llvm.nvvm.texsurf.handle must be kept as an immediate or constant value, i.e. that global variable. However, optimizations will find common code in the following

if (cond) {
  %hnd = texsurf.handle.internal(@tex1);
} else {
  %hnd = texsurf.handle.internal(@tex2)
}
= use(%hnd)

and hoist or sink it into

if (cond) {
  %ptr = @tex1;
} else {
  %ptr = @tex2;
}
%hnd = texsurf.handle.intenal(%ptr);
= use(%hnd)

The backend cannot handle non immediate operand in texsurf.handle. The similar thing happens to read.register as well as it also assumes its argument is always an immediate value.

I wonder if we can use token types to represent the handle? https://reviews.llvm.org/D11861
@majnemer -- would this use case be suitable for the token type?

If we still could make PHI over token, it canont serve this purpose. Check llvm::canReplaceOperandWithVariable for operand for details.

Apr 11 2020, 11:43 AM · Restricted Project

Apr 7 2020

majnemer added inline comments to D77437: [lld][WebAssembly] Handle 4gb max memories.
Apr 7 2020, 7:38 PM · Restricted Project

Mar 26 2020

majnemer accepted D76664: [ConstantFold][NFC] Compile time optimization for large vectors.

LGTM

Mar 26 2020, 10:50 AM · Restricted Project

Mar 24 2020

majnemer added inline comments to D76664: [ConstantFold][NFC] Compile time optimization for large vectors.
Mar 24 2020, 6:03 PM · Restricted Project
majnemer added inline comments to D76664: [ConstantFold][NFC] Compile time optimization for large vectors.
Mar 24 2020, 3:06 PM · Restricted Project
majnemer added a comment to D76664: [ConstantFold][NFC] Compile time optimization for large vectors.

Please upload with full context.

Mar 24 2020, 10:44 AM · Restricted Project

Mar 23 2020

majnemer added inline comments to D76664: [ConstantFold][NFC] Compile time optimization for large vectors.
Mar 23 2020, 7:36 PM · Restricted Project

Nov 3 2019

majnemer added a reviewer for D69776: [APFloat] Fix FP remainder operation: scanon.
Nov 3 2019, 1:42 PM · Restricted Project

Oct 28 2019

majnemer retitled D69477: [InstCombine] keep assumption before sinking calls from [InstCombine] keep assumption before skinking calls to [InstCombine] keep assumption before sinking calls.
Oct 28 2019, 3:45 PM · Restricted Project

Oct 17 2019

majnemer added inline comments to D69110: [DFAPacketizer] Allow up to 64 functional units.
Oct 17 2019, 10:33 AM · Restricted Project

Oct 8 2019

majnemer accepted D68570: Unify the two CRC implementations.

LGTM

Oct 8 2019, 10:36 AM · Restricted Project, Restricted Project, Restricted Project

Oct 2 2019

majnemer accepted D67968: [TableGen] Introduce a generic automaton (DFA) backend.

LGTM

Oct 2 2019, 4:20 PM · Restricted Project

Sep 26 2019

majnemer added inline comments to D67968: [TableGen] Introduce a generic automaton (DFA) backend.
Sep 26 2019, 2:33 PM · Restricted Project

Sep 19 2019

majnemer accepted D67356: [InstCombine] Simplify @llvm.usub.with.overflow+non-zero check (PR43251).

LGTM

Sep 19 2019, 10:01 AM · Restricted Project

Sep 12 2019

majnemer added inline comments to D67507: Refer to IEEE 754-2019 in langref instead of 2018 draft.
Sep 12 2019, 10:21 AM · Restricted Project

Sep 4 2019

majnemer added inline comments to D66827: Add support for MS qualifiers __ptr32, __ptr64, __sptr, __uptr..
Sep 4 2019, 3:29 PM · Restricted Project, Restricted Project

Aug 28 2019

majnemer added inline comments to D66836: [libc++] Add `__truncating_cast` for safely casting float types to integers.
Aug 28 2019, 5:35 PM · Restricted Project

Aug 23 2019

majnemer added a reviewer for D64665: [MachinePipeliner] Refactor schedule emission logic: ThomasRaoux.
Aug 23 2019, 2:23 PM · Restricted Project
majnemer added a reviewer for D66368: [MachinePipeliner] Factor experimental codegen into a class: ThomasRaoux.
Aug 23 2019, 2:15 PM · Restricted Project

Aug 14 2019

majnemer added inline comments to D66190: [CodeGen] Add a pass to do block predication on SSA machine IR.
Aug 14 2019, 5:12 PM · Restricted Project
majnemer added inline comments to D64665: [MachinePipeliner] Refactor schedule emission logic.
Aug 14 2019, 4:58 PM · Restricted Project

Jul 15 2019

majnemer added inline comments to D63396: [WinEH] Allocate space in funclets stack to save XMM CSRs.
Jul 15 2019, 9:39 PM · Restricted Project

Jul 6 2019

majnemer committed rG617df204b5b4: [CodeGen] Add larger vector types for i32 and f32 (authored by majnemer).
[CodeGen] Add larger vector types for i32 and f32
Jul 6 2019, 9:51 PM
majnemer committed rL365274: [CodeGen] Add larger vector types for i32 and f32.
[CodeGen] Add larger vector types for i32 and f32
Jul 6 2019, 9:48 PM
majnemer closed D64141: [CodeGen] Add larger vector types for i32 and f32.
Jul 6 2019, 9:48 PM · Restricted Project

Jul 3 2019

majnemer accepted D64141: [CodeGen] Add larger vector types for i32 and f32.

Most of this looks mechanical; I don't think the MVT changes should be contentious. However, the "is65536BitVector()" predicates are starting to get a bit unwieldy to read.

Does an out of tree target need these predicates? I feel they're sufficiently unreadable to either change the format ("is64kBitVector"?) or elide them for larger types.

Cheers,

James

I agree, it is not really needed I added it for consistency. I don't mind changing it to the format suggested. Which ones do you think should be changed?

Jul 3 2019, 11:39 AM · Restricted Project

Apr 1 2019

majnemer accepted D60079: [PruneEH] Don't split musttail call from ret.

LGTM

Apr 1 2019, 7:13 PM · Restricted Project
majnemer accepted D60080: [SimplifyCFG] Don't split musttail call from ret.

LGTM

Apr 1 2019, 7:13 PM · Restricted Project

Mar 12 2019

majnemer added inline comments to D59286: Allow pointer to static member function.
Mar 12 2019, 8:39 PM

Jan 23 2019

majnemer added a comment to D53765: [RFC prototype] Implementation of asm-goto support in LLVM.

Do you have any tests which perform a callbr with a normal function target rather than inline asm?

No, and Verifier.cpp currently errors for it.

Jan 23 2019, 3:49 PM · Restricted Project

Jan 22 2019

majnemer added a comment to D53765: [RFC prototype] Implementation of asm-goto support in LLVM.

Do you have any tests which perform a callbr with a normal function target rather than inline asm?

Jan 22 2019, 6:14 PM · Restricted Project

Jan 8 2019

majnemer added inline comments to D56466: [CodeGen] Clarify comment about COFF common symbol alignment.
Jan 8 2019, 4:51 PM

Jan 7 2019

majnemer added inline comments to D56391: Limit COFF 'common' emission to <=32 alignment types..
Jan 7 2019, 12:41 PM

Dec 18 2018

majnemer added inline comments to D55853: Ignore ConstantExpr in IgnoreParens.
Dec 18 2018, 2:17 PM

Dec 14 2018

majnemer added inline comments to D55715: Add AddressSpace mangling to MS mode.
Dec 14 2018, 11:44 AM

Nov 29 2018

majnemer accepted D55077: [Mem2Reg] Fix nondeterministic corner case.

LGTM

Nov 29 2018, 4:54 PM
majnemer accepted D54965: [obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables.

LGTM

Nov 29 2018, 10:45 AM

Nov 12 2018

majnemer added inline comments to D53877: [IR] Strawman for dedicated FNeg IR instruction.
Nov 12 2018, 8:37 AM · Restricted Project

Oct 31 2018

majnemer added inline comments to D53540: [COFF, ARM64] Implement support for SEH extensions __try/__except/__finally.
Oct 31 2018, 1:06 PM

Oct 8 2018

majnemer added inline comments to D53000: [Support] exit with custom return code for SIGPIPE.
Oct 8 2018, 3:59 PM · Restricted Project

Sep 27 2018

majnemer added inline comments to D52384: [Sema] Fix redeclaration contexts for enumerators in C.
Sep 27 2018, 10:53 PM

Sep 25 2018

majnemer accepted D52499: [clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074).

FWIW, Microsoft's newest documentation does not say that /O2 and /O1 imply /Gs: https://docs.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=vs-2017

Sep 25 2018, 11:19 AM

Sep 24 2018

majnemer added inline comments to D51524: [ARM64] [Windows] Handle funclets.
Sep 24 2018, 11:50 PM
majnemer added inline comments to D51524: [ARM64] [Windows] Handle funclets.
Sep 24 2018, 8:04 PM
majnemer added inline comments to D51524: [ARM64] [Windows] Handle funclets.
Sep 24 2018, 5:12 PM

Sep 7 2018

majnemer accepted D51820: [COFF] Implement llvm.global_ctors priorities for MSVC COFF targets.

LGTM

Sep 7 2018, 3:49 PM

Aug 22 2018

majnemer accepted D51149: MC: Don't align COFF section contents..

LGTM

Aug 22 2018, 10:10 PM

Aug 16 2018

majnemer added a comment to D50877: [MS] Mangle a hash of the main file path into anonymous namespaces.

How does MSVC handle this case? What mangled name does it generate?

Aug 16 2018, 5:27 PM

Aug 15 2018

majnemer accepted D50806: [MS Demangler] Demangle string literals.

LGTM

Aug 15 2018, 2:25 PM

Aug 7 2018

majnemer added inline comments to D50394: [MS Demangler] Properly handle backreferences of special names.
Aug 7 2018, 10:33 AM
majnemer accepted D50394: [MS Demangler] Properly handle backreferences of special names.

LGTM

Aug 7 2018, 10:33 AM

Aug 5 2018

majnemer added inline comments to D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case).
Aug 5 2018, 2:39 PM · Restricted Project

Aug 4 2018

majnemer added inline comments to D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case).
Aug 4 2018, 10:35 PM · Restricted Project

Aug 1 2018

majnemer accepted D50145: [MS Demangler] Demangle templated operator overloads.

LGTM

Aug 1 2018, 11:18 AM

Jul 29 2018

majnemer added inline comments to D49965: [MS Demangler] Demangle symbols in function local scopes.
Jul 29 2018, 7:32 PM
majnemer added a comment to D49965: [MS Demangler] Demangle symbols in function local scopes.

I had thought of a tryDemangleNumber function but it didn’t really fit the
style of code . (Ie I don’t really do that anywhere else so it felt a
little out of place). I can still do that if you think it’s better, I don’t
have a strong preference

Jul 29 2018, 6:09 PM
majnemer accepted D49965: [MS Demangler] Demangle symbols in function local scopes.
Jul 29 2018, 6:09 PM
majnemer added inline comments to D49965: [MS Demangler] Demangle symbols in function local scopes.
Jul 29 2018, 2:33 PM

Jul 25 2018

majnemer added inline comments to D49821: [MC] Add support for the .rva assembler directive for COFF targets.
Jul 25 2018, 2:50 PM

Jul 23 2018

majnemer added inline comments to D49644: [COFF] Hoist constant pool handling from X86AsmPrinter into AsmPrinter.
Jul 23 2018, 12:29 PM