SuccessChanges

Summary

  1. Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value 'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl flags produce much less confusing output as well. Fixes PR29106. Since an arg and its alias can have different arg types (joined vs not) and different values (because of AliasArgs<>), I chose to give the Alias its own Arg object. For convenience, I just store the alias directly in the unaliased arg – there aren't many arg objects at runtime, so that seems ok. Finally, I changed Arg::getAsString() to use the alias's representation if it's present – that function was already documented as being the suitable function for diagnostics, and most callers already used it for diagnostics. Implementation-wise, Arg::accept() previously used to parse things as the unaliased option. The core of that switch is now extracted into a new function acceptInternal() which parses as the _aliased_ option, and the previously-intermingled unaliasing is now done as an explicit step afterwards. (This also changes one place in lld that didn't use getAsString() for diagnostics, so that that one place now also prints the flag as the user wrote it, not as it looks after it went through unaliasing.) Differential Revision: https://reviews.llvm.org/D64253
  2. [Attributor] Deduce the "returned" argument attribute Deduce the "returned" argument attribute by collecting all potentially returned values. Not only the unique return value, if any, can be used by subsequent attributes but also the set of all potentially returned values as well as the mapping from returned values to return instructions that they originate from (see AAReturnedValues::checkForallReturnedValues). Change in statistics (-stats) for LLVM-TS + Spec2006, totaling ~19% more "returned" arguments. ADDED: attributor NumAttributesManifested n/a -> 637 ADDED: attributor NumAttributesValidFixpoint n/a -> 25545 ADDED: attributor NumFnArgumentReturned n/a -> 637 ADDED: attributor NumFnKnownReturns n/a -> 25545 ADDED: attributor NumFnUniqueReturned n/a -> 14118 CHANGED: deadargelim NumRetValsEliminated 470 -> 449 ( -4.468%) REMOVED: functionattrs NumReturned 535 -> n/a CHANGED: indvars NumElimIdentity 138 -> 164 ( +18.841%) Reviewers: homerdin, hfinkel, fedor.sergeev, sanjoy, spatel, nlopes, nicholas, reames, efriedma, chandlerc Subscribers: hiraditya, bollu, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59919
Revision 365413 by nico:
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics

With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.

Fixes PR29106.

Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.

Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.

Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.

(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)

Differential Revision: https://reviews.llvm.org/D64253
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/test/Driver/arm-execute-only.cN/A
The file was modified/cfe/trunk/test/Driver/cl-options.cN/A
The file was modified/cfe/trunk/test/Driver/darwin-version.cN/A
The file was modified/lld/trunk/Common/Reproduce.cppN/A
The file was modified/lld/trunk/ELF/Driver.cppN/A
The file was modified/lld/trunk/test/ELF/sectionstart.sN/A
The file was modified/llvm/trunk/include/llvm/Option/Arg.htrunk/include/llvm/Option/Arg.h
The file was modified/llvm/trunk/include/llvm/Option/Option.htrunk/include/llvm/Option/Option.h
The file was modified/llvm/trunk/lib/Option/Arg.cpptrunk/lib/Option/Arg.cpp
The file was modified/llvm/trunk/lib/Option/Option.cpptrunk/lib/Option/Option.cpp
Revision 365407 by jdoerfert:
[Attributor] Deduce the "returned" argument attribute

Deduce the "returned" argument attribute by collecting all potentially
returned values.

Not only the unique return value, if any, can be used by subsequent
attributes but also the set of all potentially returned values as well
as the mapping from returned values to return instructions that they
originate from (see AAReturnedValues::checkForallReturnedValues).

Change in statistics (-stats) for LLVM-TS + Spec2006, totaling ~19% more "returned" arguments.

  ADDED: attributor                   NumAttributesManifested                  n/a ->        637
  ADDED: attributor                   NumAttributesValidFixpoint               n/a ->      25545
  ADDED: attributor                   NumFnArgumentReturned                    n/a ->        637
  ADDED: attributor                   NumFnKnownReturns                        n/a ->      25545
  ADDED: attributor                   NumFnUniqueReturned                      n/a ->      14118
CHANGED: deadargelim                  NumRetValsEliminated                     470 ->        449 (    -4.468%)
REMOVED: functionattrs                NumReturned                              535 ->        n/a
CHANGED: indvars                      NumElimIdentity                          138 ->        164 (   +18.841%)

Reviewers: homerdin, hfinkel, fedor.sergeev, sanjoy, spatel, nlopes, nicholas, reames, efriedma, chandlerc

Subscribers: hiraditya, bollu, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D59919
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/Transforms/IPO/Attributor.htrunk/include/llvm/Transforms/IPO/Attributor.h
The file was modified/llvm/trunk/lib/Transforms/IPO/Attributor.cpptrunk/lib/Transforms/IPO/Attributor.cpp
The file was modified/llvm/trunk/test/Transforms/FunctionAttrs/arg_nocapture.lltrunk/test/Transforms/FunctionAttrs/arg_nocapture.ll
The file was modified/llvm/trunk/test/Transforms/FunctionAttrs/arg_returned.lltrunk/test/Transforms/FunctionAttrs/arg_returned.ll
The file was modified/llvm/trunk/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.lltrunk/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll

Summary

  1. Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value 'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl flags produce much less confusing output as well. Fixes PR29106. Since an arg and its alias can have different arg types (joined vs not) and different values (because of AliasArgs<>), I chose to give the Alias its own Arg object. For convenience, I just store the alias directly in the unaliased arg – there aren't many arg objects at runtime, so that seems ok. Finally, I changed Arg::getAsString() to use the alias's representation if it's present – that function was already documented as being the suitable function for diagnostics, and most callers already used it for diagnostics. Implementation-wise, Arg::accept() previously used to parse things as the unaliased option. The core of that switch is now extracted into a new function acceptInternal() which parses as the _aliased_ option, and the previously-intermingled unaliasing is now done as an explicit step afterwards. (This also changes one place in lld that didn't use getAsString() for diagnostics, so that that one place now also prints the flag as the user wrote it, not as it looks after it went through unaliasing.) Differential Revision: https://reviews.llvm.org/D64253
  2. [X86][PPC] Support -mlong-double-64 -mlong-double-64 is supported on some ports of gcc (i386, x86_64, and ppc{32,64}). On many other targets, there will be an error: error: unrecognized command line option '-mlong-double-64' This patch makes the driver option -mlong-double-64 available for x86 and ppc. The CC1 option -mlong-double-64 is available on all targets for users to test on unsupported targets. LongDoubleSize is added as a VALUE_LANGOPT so that the option can be shared with -mlong-double-128 when we support it in clang. Also, make powerpc*-linux-musl default to use 64-bit long double. It is currently the only supported ABI on musl and is also how people configure powerpc*-linux-musl-gcc. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D64067
  3. clang-cl: Port cl.exe's C4659 to clang-cl Differential Revision: https://reviews.llvm.org/D64349
  4. [analyzer] exploded-graph-rewriter: Implement a topology-only mode. In this mode the rewriter will only rewrite program points and omit program states. Useful for understanding the rough topology of the graph. Differential Revision: https://reviews.llvm.org/D64264
  5. [analyzer] exploded-graph-rewriter: Implement a single-path mode. Instead of rewriting the whole graph, rewrite the leftmost path in the graph. Useful for trimmed graphs that are still too large to display due to multiple equivalent reports mixed into them. Differential Revision: https://reviews.llvm.org/D64263
  6. [ObjC] Add a -Wtautological-compare warning for BOOL On macOS, BOOL is a typedef for signed char, but it should never hold a value that isn't 1 or 0. Any code that expects a different value in their BOOL should be fixed. rdar://51954400 Differential revision: https://reviews.llvm.org/D63856
  7. [cxx2a] P0624R2 fix: only lambdas with no lambda-capture are default-constructible and assignable. This is a fix for rG864949 which only disabled default construction and assignment for lambdas with capture-defaults, where the C++2a draft disables them for lambdas with any lambda-capture at all. Patch by Logan Smith! Differential Revision: https://reviews.llvm.org/D64058
  8. [Frontend] Explicitly include Bitstream/BitCodes.h and BitstreamWriter.h This fixes a modules issue: error: declaration of 'bitc' must be imported from module 'Clang_Serialization.ASTBitCodes' before it is required Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
Revision 365413 by nico:
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics

With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.

Fixes PR29106.

Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.

Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.

Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.

(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)

Differential Revision: https://reviews.llvm.org/D64253
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/test/Driver/arm-execute-only.ctrunk/test/Driver/arm-execute-only.c
The file was modified/cfe/trunk/test/Driver/cl-options.ctrunk/test/Driver/cl-options.c
The file was modified/cfe/trunk/test/Driver/darwin-version.ctrunk/test/Driver/darwin-version.c
The file was modified/lld/trunk/Common/Reproduce.cppN/A
The file was modified/lld/trunk/ELF/Driver.cppN/A
The file was modified/lld/trunk/test/ELF/sectionstart.sN/A
The file was modified/llvm/trunk/include/llvm/Option/Arg.hN/A
The file was modified/llvm/trunk/include/llvm/Option/Option.hN/A
The file was modified/llvm/trunk/lib/Option/Arg.cppN/A
The file was modified/llvm/trunk/lib/Option/Option.cppN/A
Revision 365412 by maskray:
[X86][PPC] Support -mlong-double-64

-mlong-double-64 is supported on some ports of gcc (i386, x86_64, and ppc{32,64}).
On many other targets, there will be an error:

    error: unrecognized command line option '-mlong-double-64'

This patch makes the driver option -mlong-double-64 available for x86
and ppc. The CC1 option -mlong-double-64 is available on all targets for
users to test on unsupported targets.

LongDoubleSize is added as a VALUE_LANGOPT so that the option can be
shared with -mlong-double-128 when we support it in clang.

Also, make powerpc*-linux-musl default to use 64-bit long double. It is
currently the only supported ABI on musl and is also how people
configure powerpc*-linux-musl-gcc.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D64067
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/LangOptions.deftrunk/include/clang/Basic/LangOptions.def
The file was modified/cfe/trunk/include/clang/Driver/Options.tdtrunk/include/clang/Driver/Options.td
The file was modified/cfe/trunk/lib/Basic/TargetInfo.cpptrunk/lib/Basic/TargetInfo.cpp
The file was modified/cfe/trunk/lib/Basic/Targets/PPC.htrunk/lib/Basic/Targets/PPC.h
The file was modified/cfe/trunk/lib/Driver/ToolChains/Clang.cpptrunk/lib/Driver/ToolChains/Clang.cpp
The file was modified/cfe/trunk/lib/Frontend/CompilerInvocation.cpptrunk/lib/Frontend/CompilerInvocation.cpp
The file was removed/cfe/trunk/test/CodeGen/long-double-x86.ctrunk/test/CodeGen/long-double-x86.c
The file was removed/cfe/trunk/test/CodeGen/ppc64-align-long-double.ctrunk/test/CodeGen/ppc64-align-long-double.c
The file was added/cfe/trunk/test/CodeGen/ppc64-long-double.cpptrunk/test/CodeGen/ppc64-long-double.cpp
The file was added/cfe/trunk/test/CodeGen/x86-long-double.cpptrunk/test/CodeGen/x86-long-double.cpp
The file was added/cfe/trunk/test/Driver/mlong-double-64.ctrunk/test/Driver/mlong-double-64.c
Revision 365411 by nico:
clang-cl: Port cl.exe's C4659 to clang-cl

Differential Revision: https://reviews.llvm.org/D64349
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/Attr.tdtrunk/include/clang/Basic/Attr.td
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticGroups.tdtrunk/include/clang/Basic/DiagnosticGroups.td
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.tdtrunk/include/clang/Basic/DiagnosticSemaKinds.td
The file was modified/cfe/trunk/lib/Sema/SemaAttr.cpptrunk/lib/Sema/SemaAttr.cpp
The file was modified/cfe/trunk/lib/Sema/SemaDeclAttr.cpptrunk/lib/Sema/SemaDeclAttr.cpp
The file was modified/cfe/trunk/test/Sema/pragma-section.ctrunk/test/Sema/pragma-section.c
Revision 365410 by dergachev:
[analyzer] exploded-graph-rewriter: Implement a topology-only mode.

In this mode the rewriter will only rewrite program points
and omit program states. Useful for understanding
the rough topology of the graph.

Differential Revision: https://reviews.llvm.org/D64264
Change TypePath in RepositoryPath in Workspace
The file was added/cfe/trunk/test/Analysis/exploded-graph-rewriter/topology.dottrunk/test/Analysis/exploded-graph-rewriter/topology.dot
The file was modified/cfe/trunk/utils/analyzer/exploded-graph-rewriter.pytrunk/utils/analyzer/exploded-graph-rewriter.py
Revision 365409 by dergachev:
[analyzer] exploded-graph-rewriter: Implement a single-path mode.

Instead of rewriting the whole graph, rewrite the leftmost path in the
graph. Useful for trimmed graphs that are still too large to display due
to multiple equivalent reports mixed into them.

Differential Revision: https://reviews.llvm.org/D64263
Change TypePath in RepositoryPath in Workspace
The file was added/cfe/trunk/test/Analysis/exploded-graph-rewriter/explorers.dottrunk/test/Analysis/exploded-graph-rewriter/explorers.dot
The file was modified/cfe/trunk/utils/analyzer/exploded-graph-rewriter.pytrunk/utils/analyzer/exploded-graph-rewriter.py
Revision 365408 by epilk:
[ObjC] Add a -Wtautological-compare warning for BOOL

On macOS, BOOL is a typedef for signed char, but it should never hold a value
that isn't 1 or 0. Any code that expects a different value in their BOOL should
be fixed.

rdar://51954400

Differential revision: https://reviews.llvm.org/D63856
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticGroups.tdtrunk/include/clang/Basic/DiagnosticGroups.td
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.tdtrunk/include/clang/Basic/DiagnosticSemaKinds.td
The file was modified/cfe/trunk/lib/Sema/SemaChecking.cpptrunk/lib/Sema/SemaChecking.cpp
The file was added/cfe/trunk/test/Sema/tautological-objc-bool-compare.mtrunk/test/Sema/tautological-objc-bool-compare.m
Revision 365406 by dblaikie:
[cxx2a] P0624R2 fix: only lambdas with no lambda-capture are default-constructible and assignable.

This is a fix for rG864949 which only disabled default construction and
assignment for lambdas with capture-defaults, where the C++2a draft
disables them for lambdas with any lambda-capture at all.

Patch by Logan Smith!

Differential Revision: https://reviews.llvm.org/D64058
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/lib/AST/DeclCXX.cpptrunk/lib/AST/DeclCXX.cpp
The file was modified/cfe/trunk/lib/Sema/SemaDeclCXX.cpptrunk/lib/Sema/SemaDeclCXX.cpp
The file was modified/cfe/trunk/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpptrunk/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp
Revision 365405 by thegameg:
[Frontend] Explicitly include Bitstream/BitCodes.h and BitstreamWriter.h

This fixes a modules issue:

error: declaration of 'bitc' must be imported from module
'Clang_Serialization.ASTBitCodes' before it is required
Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpptrunk/lib/Frontend/SerializedDiagnosticPrinter.cpp