teak-llvm/clang/lib/CodeGen
Guillaume Chatelet 805c157e8a [Alignment][NFC] Deprecate Align::None()
Summary:
This is a follow up on https://reviews.llvm.org/D71473#inline-647262.
There's a caveat here that `Align(1)` relies on the compiler understanding of `Log2_64` implementation to produce good code. One could use `Align()` as a replacement but I believe it is less clear that the alignment is one in that case.

Reviewers: xbolva00, courbet, bollu

Subscribers: arsenm, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, jrtc27, atanasyan, jsji, Jim, kerbowa, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D73099
2020-01-24 12:53:58 +01:00
..
ABIInfo.h
Address.h
BackendUtil.cpp Revert "[LTO/WPD] Enable aggressive WPD under LTO option" 2020-01-23 17:29:24 -08:00
CGAtomic.cpp [Alignment][NFC] CreateMemSet use MaybeAlign 2019-12-10 15:17:44 +01:00
CGBlocks.cpp [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
CGBlocks.h
CGBuilder.h [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
CGBuiltin.cpp [Alignment][NFC] Deprecate Align::None() 2020-01-24 12:53:58 +01:00
CGCall.cpp [MS] Overhaul how clang passes overaligned args on x86_32 2020-01-23 16:04:00 -08:00
CGCall.h Run clang-format on lib/CodeGen/CGCall.h and fix indentation 2019-10-30 18:06:12 -07:00
CGClass.cpp Revert "[LTO/WPD] Enable aggressive WPD under LTO option" 2020-01-23 17:29:24 -08:00
CGCleanup.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
CGCleanup.h
CGCoroutine.cpp Fix parameter name comments using clang-tidy. NFC. 2019-07-16 04:46:31 +00:00
CGCUDANV.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
CGCUDARuntime.cpp
CGCUDARuntime.h [HIP] Add the interface deriving the stub name of device kernels. 2019-06-17 12:51:36 +00:00
CGCXX.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
CGCXXABI.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
CGCXXABI.h Improve code generation for thread_local variables: 2019-09-12 20:00:24 +00:00
CGDebugInfo.cpp Recommit "[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions." 2020-01-24 14:50:17 +05:30
CGDebugInfo.h Recommit "[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions." 2020-01-24 14:50:17 +05:30
CGDecl.cpp [Concepts] Requires Expressions 2020-01-19 00:23:26 +02:00
CGDeclCXX.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
CGException.cpp [clang] Set function attributes on SEH filter functions correctly. 2020-01-17 18:09:42 +00:00
CGExpr.cpp Revert "[ARM] Follow AACPS standard for volatile bit-fields access width" 2020-01-21 15:31:33 +00:00
CGExprAgg.cpp [c++20] P1959R0: Remove support for std::*_equality. 2019-12-16 17:49:45 -08:00
CGExprComplex.cpp [OPENMP50]Codegen for lastprivate conditional list items. 2020-01-02 16:43:00 -05:00
CGExprConstant.cpp Use hasOffsetApplied to initialize member HasOffsetApplied 2019-12-18 13:56:59 -08:00
CGExprCXX.cpp Fix "pointer is null" static analyzer warnings. NFCI. 2020-01-11 16:02:23 +00:00
CGExprScalar.cpp [Concepts] Requires Expressions 2020-01-19 00:23:26 +02:00
CGGPUBuiltin.cpp [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
CGLoopInfo.cpp [Clang] Pragma vectorize_width() implies vectorize(enable) 2019-12-11 10:37:40 +00:00
CGLoopInfo.h Don't keep stale pointers to LoopInfos. 2019-08-19 13:37:41 +00:00
CGNonTrivialStruct.cpp [NFC] Pass a reference to CodeGenFunction to methods of LValue and 2019-12-03 15:22:13 -08:00
CGObjC.cpp Relax the rules around objc_alloc and objc_alloc_init optimizations. 2020-01-14 19:48:33 -08:00
CGObjCGNU.cpp [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
CGObjCMac.cpp [Alignment][NFC] Deprecate Align::None() 2020-01-24 12:53:58 +01:00
CGObjCRuntime.cpp
CGObjCRuntime.h Implement __attribute__((objc_direct)), __attribute__((objc_direct_members)) 2019-11-18 11:48:40 -08:00
CGOpenCLRuntime.cpp Fix "pointer is null" static analyzer warning. NFCI. 2020-01-08 17:19:08 +00:00
CGOpenCLRuntime.h
CGOpenMPRuntime.cpp [OPENMP]Improve debug locations in OpenMP regions. 2020-01-17 14:24:32 -05:00
CGOpenMPRuntime.h [OPENMP]Remove unused code, NFC. 2020-01-09 09:50:46 -05:00
CGOpenMPRuntimeNVPTX.cpp [OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang 2019-12-26 11:04:07 -06:00
CGOpenMPRuntimeNVPTX.h [OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang 2019-12-26 11:04:07 -06:00
CGRecordLayout.h
CGRecordLayoutBuilder.cpp P0840R2: support for [[no_unique_address]] attribute 2019-06-20 20:44:45 +00:00
CGStmt.cpp [DebugInfo] Add another level to DebugInfoKind called Constructor 2020-01-13 15:59:03 -08:00
CGStmtOpenMP.cpp [OPENMP]Improve debug locations in OpenMP regions. 2020-01-17 14:24:32 -05:00
CGValue.h Revert "[ARM] Follow AACPS standard for volatile bit-fields access width" 2020-01-21 15:31:33 +00:00
CGVTables.cpp Revert "[LTO/WPD] Enable aggressive WPD under LTO option" 2020-01-23 17:29:24 -08:00
CGVTables.h
CGVTT.cpp
CMakeLists.txt Generalize the pass registration mechanism used by Polly to any third-party tool 2020-01-02 16:45:31 +01:00
CodeGenABITypes.cpp Fix parameter name comments using clang-tidy. NFC. 2019-07-16 04:46:31 +00:00
CodeGenAction.cpp [remark][diagnostics] Using clang diagnostic handler for IR input files 2020-01-14 15:44:57 -08:00
CodeGenFunction.cpp [Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0 2020-01-23 17:02:54 -08:00
CodeGenFunction.h Revert "[ARM] Follow AACPS standard for volatile bit-fields access width" 2020-01-21 15:31:33 +00:00
CodeGenModule.cpp [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
CodeGenModule.h Revert "[LTO/WPD] Enable aggressive WPD under LTO option" 2020-01-23 17:29:24 -08:00
CodeGenPGO.cpp [NFC] Fixes -Wrange-loop-analysis warnings 2020-01-01 20:01:37 +01:00
CodeGenPGO.h Fix uninitialized variable warning in CodeGenPGO constructor. NFCI. 2019-10-02 21:05:21 +00:00
CodeGenTBAA.cpp Fix detection of __attribute__((may_alias)) to properly look through 2019-12-11 14:04:37 -08:00
CodeGenTBAA.h
CodeGenTypeCache.h
CodeGenTypes.cpp Silence static analyzer getAs<RecordType> null dereference warnings. NFCI. 2019-10-03 11:22:48 +00:00
CodeGenTypes.h
ConstantEmitter.h [CodeGen] Fix clang crash on aggregate initialization of array of labels 2019-11-28 00:59:25 +01:00
ConstantInitBuilder.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
CoverageMappingGen.cpp Revert "[Coverage] Revise format to reduce binary size" 2019-12-04 10:35:14 -08:00
CoverageMappingGen.h Revert "[Coverage] Revise format to reduce binary size" 2019-12-04 10:35:14 -08:00
EHScopeStack.h Replace llvm::integer_sequence and friends with the C++14 standard version 2019-08-15 10:56:05 +00:00
ItaniumCXXABI.cpp Revert "[LTO/WPD] Enable aggressive WPD under LTO option" 2020-01-23 17:29:24 -08:00
MacroPPCallbacks.cpp
MacroPPCallbacks.h
MicrosoftCXXABI.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
ModuleBuilder.cpp reland "[DebugInfo] Support to emit debugInfo for extern variables" 2019-12-22 18:28:50 -08:00
ObjectFilePCHContainerOperations.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
PatternInit.cpp CodeGet: Init 32bit pointers with 0xFFFFFFFF 2019-07-12 17:21:55 +00:00
PatternInit.h
README.txt
SanitizerMetadata.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
SanitizerMetadata.h
SwiftCallingConv.cpp
TargetInfo.cpp [MS] Overhaul how clang passes overaligned args on x86_32 2020-01-23 16:04:00 -08:00
TargetInfo.h [OpenCL][PR41727] Prevent ICE on global dtors 2019-07-15 11:58:10 +00:00
VarBypassDetector.cpp
VarBypassDetector.h

IRgen optimization opportunities.

//===---------------------------------------------------------------------===//

The common pattern of
--
short x; // or char, etc
(x == 10)
--
generates an zext/sext of x which can easily be avoided.

//===---------------------------------------------------------------------===//

Bitfields accesses can be shifted to simplify masking and sign
extension. For example, if the bitfield width is 8 and it is
appropriately aligned then is is a lot shorter to just load the char
directly.

//===---------------------------------------------------------------------===//

It may be worth avoiding creation of alloca's for formal arguments
for the common situation where the argument is never written to or has
its address taken. The idea would be to begin generating code by using
the argument directly and if its address is taken or it is stored to
then generate the alloca and patch up the existing code.

In theory, the same optimization could be a win for block local
variables as long as the declaration dominates all statements in the
block.

NOTE: The main case we care about this for is for -O0 -g compile time
performance, and in that scenario we will need to emit the alloca
anyway currently to emit proper debug info. So this is blocked by
being able to emit debug information which refers to an LLVM
temporary, not an alloca.

//===---------------------------------------------------------------------===//

We should try and avoid generating basic blocks which only contain
jumps. At -O0, this penalizes us all the way from IRgen (malloc &
instruction overhead), all the way down through code generation and
assembly time.

On 176.gcc:expr.ll, it looks like over 12% of basic blocks are just
direct branches!

//===---------------------------------------------------------------------===//