Explorar o código

commit for merge

HOLZSCHUCH Nicolas %!s(int64=7) %!d(string=hai) anos
pai
achega
904f7bf9c7

+ 0 - 3
CMakeLists.txt

@@ -194,9 +194,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 option(LLVM_INSTALL_BINUTILS_SYMLINKS
   "Install symlinks from the binutils tool names to the corresponding LLVM tools." OFF)
 
-option(LLVM_INSTALL_CCTOOLS_SYMLINKS
-  "Install symlinks from the cctools tool names to the corresponding LLVM tools." OFF)
-
 option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OFF)
 
 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)

+ 1 - 1
CODE_OWNERS.TXT

@@ -61,7 +61,7 @@ E: peter@pcc.me.uk
 D: llgo, libLTO (lib/LTO/* tools/lto/*), LLVM Bitcode (lib/Bitcode/* include/llvm/Bitcode/*)
 
 N: Quentin Colombet
-E: qcolombet@apple.com
+E: quentin.colombet@gmail.com
 D: Loop Strength Reduction, Register allocators
 
 N: Simon Dardis

+ 0 - 85
bindings/go/llvm/DIBuilderBindings.cpp

@@ -19,27 +19,6 @@
 
 using namespace llvm;
 
-LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
-    LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
-    LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty, int AlwaysPreserve,
-    unsigned Flags, uint32_t AlignInBits) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(
-      D->createAutoVariable(unwrap<DIScope>(Scope), Name, unwrap<DIFile>(File),
-                            Line, unwrap<DIType>(Ty), AlwaysPreserve,
-                            static_cast<DINode::DIFlags>(Flags), AlignInBits));
-}
-
-LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
-    LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
-    unsigned ArgNo, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
-    int AlwaysPreserve, unsigned Flags) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(D->createParameterVariable(
-      unwrap<DIScope>(Scope), Name, ArgNo, unwrap<DIFile>(File), Line,
-      unwrap<DIType>(Ty), AlwaysPreserve, static_cast<DINode::DIFlags>(Flags)));
-}
-
 LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
                                            LLVMMetadataRef Ty, const char *Name,
                                            LLVMMetadataRef File, unsigned Line,
@@ -49,67 +28,3 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
                                File ? unwrap<DIFile>(File) : nullptr, Line,
                                Context ? unwrap<DIScope>(Context) : nullptr));
 }
-
-LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
-                                                 int64_t Lo, int64_t Count) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(D->getOrCreateSubrange(Lo, Count));
-}
-
-LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
-                                              LLVMMetadataRef *Data,
-                                              size_t Length) {
-  DIBuilder *D = unwrap(Dref);
-  Metadata **DataValue = unwrap(Data);
-  ArrayRef<Metadata *> Elements(DataValue, Length);
-  DINodeArray A = D->getOrCreateArray(Elements);
-  return wrap(A.get());
-}
-
-LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
-                                                  LLVMMetadataRef *Data,
-                                                  size_t Length) {
-  DIBuilder *D = unwrap(Dref);
-  Metadata **DataValue = unwrap(Data);
-  ArrayRef<Metadata *> Elements(DataValue, Length);
-  DITypeRefArray A = D->getOrCreateTypeArray(Elements);
-  return wrap(A.get());
-}
-
-LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
-                                              int64_t *Addr, size_t Length) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(D->createExpression(ArrayRef<int64_t>(Addr, Length)));
-}
-
-LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
-                                             LLVMValueRef Storage,
-                                             LLVMMetadataRef VarInfo,
-                                             LLVMMetadataRef Expr,
-                                             LLVMBasicBlockRef Block) {
-  // Fail immediately here until the llgo folks update their bindings.  The
-  // called function is going to assert out anyway.
-  llvm_unreachable("DIBuilder API change requires a DebugLoc");
-
-  DIBuilder *D = unwrap(Dref);
-  Instruction *Instr = D->insertDeclare(
-      unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
-      unwrap<DIExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
-  return wrap(Instr);
-}
-
-LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref,
-                                           LLVMValueRef Val,
-                                           LLVMMetadataRef VarInfo,
-                                           LLVMMetadataRef Expr,
-                                           LLVMBasicBlockRef Block) {
-  // Fail immediately here until the llgo folks update their bindings.  The
-  // called function is going to assert out anyway.
-  llvm_unreachable("DIBuilder API change requires a DebugLoc");
-
-  DIBuilder *D = unwrap(Dref);
-  Instruction *Instr = D->insertDbgValueIntrinsic(
-      unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
-      /* DebugLoc */ nullptr, unwrap(Block));
-  return wrap(Instr);
-}

+ 0 - 35
bindings/go/llvm/DIBuilderBindings.h

@@ -28,46 +28,11 @@ extern "C" {
 
 typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
 
-LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
-    LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name,
-    LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty, int AlwaysPreserve,
-    unsigned Flags, uint32_t AlignInBits);
-
-LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
-    LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name, unsigned ArgNo,
-    LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty, int AlwaysPreserve,
-    unsigned Flags);
-
 LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef D,
                                            LLVMMetadataRef Ty, const char *Name,
                                            LLVMMetadataRef File, unsigned Line,
                                            LLVMMetadataRef Context);
 
-LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef D, int64_t Lo,
-                                                 int64_t Count);
-
-LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef D,
-                                              LLVMMetadataRef *Data,
-                                              size_t Length);
-
-LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef D,
-                                                  LLVMMetadataRef *Data,
-                                                  size_t Length);
-
-LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
-                                              int64_t *Addr, size_t Length);
-
-LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef D,
-                                             LLVMValueRef Storage,
-                                             LLVMMetadataRef VarInfo,
-                                             LLVMMetadataRef Expr,
-                                             LLVMBasicBlockRef Block);
-
-LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D, LLVMValueRef Val,
-                                           LLVMMetadataRef VarInfo,
-                                           LLVMMetadataRef Expr,
-                                           LLVMBasicBlockRef Block);
-
 #ifdef __cplusplus
 } // extern "C"
 #endif

+ 8 - 8
bindings/go/llvm/dibuilder.go

@@ -239,12 +239,12 @@ func (d *DIBuilder) CreateAutoVariable(scope Metadata, v DIAutoVariable) Metadat
 	result := C.LLVMDIBuilderCreateAutoVariable(
 		d.ref,
 		scope.C,
-		name,
+		name, C.size_t(len(v.Name)),
 		v.File.C,
 		C.unsigned(v.Line),
 		v.Type.C,
-		boolToCInt(v.AlwaysPreserve),
-		C.unsigned(v.Flags),
+		C.LLVMBool(boolToCInt(v.AlwaysPreserve)),
+		C.LLVMDIFlags(v.Flags),
 		C.uint32_t(v.AlignInBits),
 	)
 	return Metadata{C: result}
@@ -271,13 +271,13 @@ func (d *DIBuilder) CreateParameterVariable(scope Metadata, v DIParameterVariabl
 	result := C.LLVMDIBuilderCreateParameterVariable(
 		d.ref,
 		scope.C,
-		name,
+		name, C.size_t(len(v.Name)),
 		C.unsigned(v.ArgNo),
 		v.File.C,
 		C.unsigned(v.Line),
 		v.Type.C,
-		boolToCInt(v.AlwaysPreserve),
-		C.unsigned(v.Flags),
+		C.LLVMBool(boolToCInt(v.AlwaysPreserve)),
+		C.LLVMDIFlags(v.Flags),
 	)
 	return Metadata{C: result}
 }
@@ -564,14 +564,14 @@ func (d *DIBuilder) CreateExpression(addr []int64) Metadata {
 // InsertDeclareAtEnd inserts a call to llvm.dbg.declare at the end of the
 // specified basic block for the given value and associated debug metadata.
 func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
-	result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, bb.C)
+	result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
 	return Value{C: result}
 }
 
 // InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the
 // specified basic block for the given value and associated debug metadata.
 func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
-	result := C.LLVMDIBuilderInsertValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, bb.C)
+	result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
 	return Value{C: result}
 }
 

+ 3 - 0
bindings/python/llvm/core.py

@@ -456,6 +456,9 @@ def register_library(library):
     library.LLVMInitializeInstCombine.argtypes = [PassRegistry]
     library.LLVMInitializeInstCombine.restype = None
 
+    library.LLVMInitializeAggressiveInstCombiner.argtypes = [PassRegistry]
+    library.LLVMInitializeAggressiveInstCombiner.restype = None
+
     library.LLVMInitializeIPO.argtypes = [PassRegistry]
     library.LLVMInitializeIPO.restype = None
 

+ 3 - 30
docs/AliasAnalysis.rst

@@ -389,11 +389,6 @@ in its ``getAnalysisUsage`` that it does so. Some passes attempt to use
 ``AU.addPreserved<AliasAnalysis>``, however this doesn't actually have any
 effect.
 
-``AliasAnalysisCounter`` (``-count-aa``) are implemented as ``ModulePass``
-classes, so if your alias analysis uses ``FunctionPass``, it won't be able to
-use these utilities. If you try to use them, the pass manager will silently
-route alias analysis queries directly to ``BasicAliasAnalysis`` instead.
-
 Similarly, the ``opt -p`` option introduces ``ModulePass`` passes between each
 pass, which prevents the use of ``FunctionPass`` alias analysis passes.
 
@@ -408,17 +403,10 @@ before it appears in an alias query. However, popular clients such as ``GVN``
 don't support this, and are known to trigger errors when run with the
 ``AliasAnalysisDebugger``.
 
-Due to several of the above limitations, the most obvious use for the
-``AliasAnalysisCounter`` utility, collecting stats on all alias queries in a
-compilation, doesn't work, even if the ``AliasAnalysis`` implementations don't
-use ``FunctionPass``.  There's no way to set a default, much less a default
-sequence, and there's no way to preserve it.
-
 The ``AliasSetTracker`` class (which is used by ``LICM``) makes a
-non-deterministic number of alias queries. This can cause stats collected by
-``AliasAnalysisCounter`` to have fluctuations among identical runs, for
-example. Another consequence is that debugging techniques involving pausing
-execution after a predetermined number of queries can be unreliable.
+non-deterministic number of alias queries. This can cause debugging techniques
+involving pausing execution after a predetermined number of queries to be
+unreliable.
 
 Many alias queries can be reformulated in terms of other alias queries. When
 multiple ``AliasAnalysis`` queries are chained together, it would make sense to
@@ -676,21 +664,6 @@ you're using the ``AliasSetTracker`` class.  To use it, use something like:
 
   % opt -ds-aa -print-alias-sets -disable-output
 
-The ``-count-aa`` pass
-^^^^^^^^^^^^^^^^^^^^^^
-
-The ``-count-aa`` pass is useful to see how many queries a particular pass is
-making and what responses are returned by the alias analysis.  As an example:
-
-.. code-block:: bash
-
-  % opt -basicaa -count-aa -ds-aa -count-aa -licm
-
-will print out how many queries (and what responses are returned) by the
-``-licm`` pass (of the ``-ds-aa`` pass) and how many queries are made of the
-``-basicaa`` pass by the ``-ds-aa`` pass.  This can be useful when debugging a
-transformation or an alias analysis implementation.
-
 The ``-aa-eval`` pass
 ^^^^^^^^^^^^^^^^^^^^^
 

+ 0 - 4
docs/CMake.rst

@@ -228,10 +228,6 @@ LLVM-specific variables
   Install symlinks from the binutils tool names to the corresponding LLVM tools.
   For example, ar will be symlinked to llvm-ar.
 
-**LLVM_INSTALL_CCTOOLS_SYMLINKS**:BOOL
-  Install symliks from the cctools tool names to the corresponding LLVM tools.
-  For example, dsymutil will be symlinked to llvm-dsymutil.
-
 **LLVM_BUILD_EXAMPLES**:BOOL
   Build LLVM examples. Defaults to OFF. Targets for building each example are
   generated in any case. See documentation for *LLVM_BUILD_TOOLS* above for more

+ 11 - 0
docs/CodingStandards.rst

@@ -826,6 +826,17 @@ As a rule of thumb, in case an ordered result is expected, remember to
 sort an unordered container before iteration. Or use ordered containers
 like vector/MapVector/SetVector if you want to iterate pointer keys.
 
+Beware of non-deterministic sorting order of equal elements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+std::sort uses a non-stable sorting algorithm in which the order of equal
+elements is not guaranteed to be preserved. Thus using std::sort for a
+container having equal elements may result in non-determinstic behavior.
+To uncover such instances of non-determinism, LLVM has introduced a new
+llvm::sort wrapper function. For an EXPENSIVE_CHECKS build this will randomly
+shuffle the container before sorting. As a rule of thumb, always make sure to
+use llvm::sort instead of std::sort.
+
 Style Issues
 ============
 

+ 3 - 4
docs/CommandGuide/llvm-mca.rst

@@ -52,7 +52,7 @@ assembly text:
     __asm volatile("# LLVM-MCA-BEGIN foo");
     a += 42;
     __asm volatile("# LLVM-MCA-END");
-    a \*= b;
+    a *= b;
     return a;
   }
 
@@ -89,9 +89,8 @@ option specifies "``-``", then the output will also be sent to standard output.
 
 .. option:: -mcpu=<cpuname>
 
- Specify the processor for whic to run the analysis.
- By default this defaults to a "generic" processor. It is not autodetected to
- the current architecture.
+  Specify the processor for which to analyze the code.  By default, the cpu name
+  is autodetected from the host.
 
 .. option:: -output-asm-variant=<variant id>
 

+ 7 - 3
docs/ReleaseNotes.rst

@@ -62,8 +62,12 @@ Non-comprehensive list of changes in this release
   applied by default.
 
 * Optimization of floating-point casts is improved. This may cause surprising
-  results for code that is relying on undefined behavior. Code sanitizers can
-  be used to detect affected patterns such as this:
+  results for code that is relying on the undefined behavior of overflowing 
+  casts. The optimization can be disabled by specifying a function attribute:
+  "fp-cast-overflow-workaround"="true". This attribute may be created by the
+  clang option :option:`-ffp-cast-overflow-workaround`.
+  Code sanitizers can be used to detect affected patterns. The option for
+  detecting this problem alone is "-fsanitize=float-cast-overflow":
 
 .. code-block:: c
 
@@ -76,7 +80,7 @@ Non-comprehensive list of changes in this release
 
 .. code-block:: bash
 
-    clang -O1 ftrunc.c -fsanitize=undefined ; ./a.out 
+    clang -O1 ftrunc.c -fsanitize=float-cast-overflow ; ./a.out 
     ftrunc.c:5:15: runtime error: 4.29497e+09 is outside the range of representable values of type 'int'
     junk in the ftrunc: 0.000000
 

+ 3 - 3
docs/TableGen/LangRef.rst

@@ -294,7 +294,7 @@ given values.
    leave it out.
 
 .. productionlist::
-   SimpleValue: "(" `DagArg` `DagArgList` ")"
+   SimpleValue: "(" `DagArg` [`DagArgList`] ")"
    DagArgList: `DagArg` ("," `DagArg`)*
    DagArg: `Value` [":" `TokVarName`] | `TokVarName`
 
@@ -325,7 +325,7 @@ It is after parsing the base class list that the "let stack" is applied.
    Body: ";" | "{" BodyList "}"
    BodyList: BodyItem*
    BodyItem: `Declaration` ";"
-           :| "let" `TokIdentifier` [`RangeList`] "=" `Value` ";"
+           :| "let" `TokIdentifier` [ "{" `RangeList` "}" ] "=" `Value` ";"
 
 The ``let`` form allows overriding the value of an inherited field.
 
@@ -353,7 +353,7 @@ a ``foreach``.
 --------
 
 .. productionlist::
-   Defm: "defm" `TokIdentifier` ":" `BaseClassListNE` ";"
+   Defm: "defm" [`TokIdentifier`] ":" `BaseClassListNE` ";"
 
 Note that in the :token:`BaseClassList`, all of the ``multiclass``'s must
 precede any ``class``'s that appear.

+ 1 - 1
docs/TableGen/index.rst

@@ -224,7 +224,7 @@ definitions of a particular class, such as "Instruction".
 
  class ProcNoItin<string Name, list<SubtargetFeature> Features>
        : Processor<Name, NoItineraries, Features>;
-  
+
 Here, the class ProcNoItin, receiving parameters `Name` of type `string` and
 a list of target features is specializing the class Processor by passing the
 arguments down as well as hard-coding NoItineraries.

+ 4 - 3
examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h

@@ -17,19 +17,20 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
-#include "llvm/ExecutionEngine/SectionMemoryManager.h"
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
 #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
 #include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
 #include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
+#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/Support/DynamicLibrary.h"
-#include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include <algorithm>

+ 1 - 0
examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h

@@ -32,6 +32,7 @@
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include <algorithm>

+ 1 - 0
examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h

@@ -32,6 +32,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include <algorithm>

+ 1 - 0
examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h

@@ -34,6 +34,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include <algorithm>

+ 2 - 1
examples/Kaleidoscope/Chapter4/toy.cpp

@@ -1,3 +1,4 @@
+#include "../include/KaleidoscopeJIT.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/BasicBlock.h"
@@ -12,9 +13,9 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
-#include "../include/KaleidoscopeJIT.h"
 #include <algorithm>
 #include <cassert>
 #include <cctype>

+ 3 - 2
examples/Kaleidoscope/Chapter5/toy.cpp

@@ -1,11 +1,12 @@
+#include "../include/KaleidoscopeJIT.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
-#include "llvm/IR/Instructions.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
@@ -13,9 +14,9 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
-#include "../include/KaleidoscopeJIT.h"
 #include <algorithm>
 #include <cassert>
 #include <cctype>

+ 3 - 2
examples/Kaleidoscope/Chapter6/toy.cpp

@@ -1,11 +1,12 @@
+#include "../include/KaleidoscopeJIT.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
-#include "llvm/IR/Instructions.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
@@ -13,9 +14,9 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
-#include "../include/KaleidoscopeJIT.h"
 #include <algorithm>
 #include <cassert>
 #include <cctype>

+ 1 - 0
examples/Kaleidoscope/Chapter7/toy.cpp

@@ -14,6 +14,7 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Utils.h"