|
42 | 42 | #include "llvm/Passes/StandardInstrumentations.h"
|
43 | 43 | #include "llvm/Support/BuryPointer.h"
|
44 | 44 | #include "llvm/Support/CommandLine.h"
|
45 |
| -#include "llvm/Support/Debug.h" |
46 | 45 | #include "llvm/Support/MemoryBuffer.h"
|
47 | 46 | #include "llvm/Support/PrettyStackTrace.h"
|
48 | 47 | #include "llvm/Support/TargetRegistry.h"
|
|
82 | 81 | #include "llvm/Transforms/Utils/SymbolRewriter.h"
|
83 | 82 | #include "llvm/Transforms/Utils/UniqueInternalLinkageNames.h"
|
84 | 83 | #include <memory>
|
85 |
| - |
86 |
| -namespace SPIRV { |
87 |
| - extern llvm::cl::opt<bool> SPIRVNoDerefAttr; |
88 |
| -} |
89 |
| - |
90 | 84 | using namespace clang;
|
91 | 85 | using namespace llvm;
|
92 | 86 |
|
@@ -622,54 +616,22 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM,
|
622 | 616 | CodeGenOpts.PrepareForThinLTO));
|
623 | 617 | }
|
624 | 618 |
|
625 |
| - // FIXME: This code is a workaround for a number of problems with optimized |
626 |
| - // SYCL code for the SPIR target. This change trying to balance between doing |
627 |
| - // too few and too many optimizations. The current approach is to disable as |
628 |
| - // much as possible just to keep the compiler functional. Eventually we can |
629 |
| - // consider allowing -On option to configure the optimization set for the FE |
630 |
| - // device compiler as well, but before that we must fix all the functional and |
631 |
| - // performance issues caused by LLVM transformantions. |
632 |
| - // E.g. LLVM optimizations make use of llvm intrinsics, instructions, data |
633 |
| - // types, etc., which are not supported by the SPIR-V translator (current |
634 |
| - // "back-end" for SYCL device compiler). |
635 |
| - // NOTE: We use "normal" inliner (i.e. from O2/O3), but limit the rest of |
636 |
| - // optimization pipeline. Inliner is a must for enabling size reduction |
637 |
| - // optimizations. |
638 |
| - if (LangOpts.SYCLIsDevice && TargetTriple.isSPIR()) { |
639 |
| - PMBuilder.OptLevel = 1; |
640 |
| - PMBuilder.SizeLevel = 2; |
641 |
| - PMBuilder.SLPVectorize = false; |
642 |
| - PMBuilder.LoopVectorize = false; |
643 |
| - PMBuilder.DivergentTarget = true; |
644 |
| - PMBuilder.DisableGVNLoadPRE = true; |
645 |
| - PMBuilder.ForgetAllSCEVInLoopUnroll = true; |
646 |
| - |
647 |
| - PMBuilder.DisableUnrollLoops = true; |
648 |
| - // Loop interleaving in the loop vectorizer has historically been set to be |
649 |
| - // enabled when loop unrolling is enabled. |
650 |
| - PMBuilder.LoopsInterleaved = false; |
651 |
| - PMBuilder.MergeFunctions = false; |
652 |
| - PMBuilder.PrepareForThinLTO = false; |
653 |
| - PMBuilder.PrepareForLTO = false; |
654 |
| - PMBuilder.RerollLoops = false; |
655 |
| - } else { |
656 |
| - PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel; |
657 |
| - PMBuilder.SizeLevel = CodeGenOpts.OptimizeSize; |
658 |
| - PMBuilder.SLPVectorize = CodeGenOpts.VectorizeSLP; |
659 |
| - PMBuilder.LoopVectorize = CodeGenOpts.VectorizeLoop; |
660 |
| - // Only enable CGProfilePass when using integrated assembler, since |
661 |
| - // non-integrated assemblers don't recognize .cgprofile section. |
662 |
| - PMBuilder.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; |
663 |
| - |
664 |
| - PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops; |
665 |
| - // Loop interleaving in the loop vectorizer has historically been set to be |
666 |
| - // enabled when loop unrolling is enabled. |
667 |
| - PMBuilder.LoopsInterleaved = CodeGenOpts.UnrollLoops; |
668 |
| - PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions; |
669 |
| - PMBuilder.PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO; |
670 |
| - PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; |
671 |
| - PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; |
672 |
| - } |
| 619 | + PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel; |
| 620 | + PMBuilder.SizeLevel = CodeGenOpts.OptimizeSize; |
| 621 | + PMBuilder.SLPVectorize = CodeGenOpts.VectorizeSLP; |
| 622 | + PMBuilder.LoopVectorize = CodeGenOpts.VectorizeLoop; |
| 623 | + // Only enable CGProfilePass when using integrated assembler, since |
| 624 | + // non-integrated assemblers don't recognize .cgprofile section. |
| 625 | + PMBuilder.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; |
| 626 | + |
| 627 | + PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops; |
| 628 | + // Loop interleaving in the loop vectorizer has historically been set to be |
| 629 | + // enabled when loop unrolling is enabled. |
| 630 | + PMBuilder.LoopsInterleaved = CodeGenOpts.UnrollLoops; |
| 631 | + PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions; |
| 632 | + PMBuilder.PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO; |
| 633 | + PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; |
| 634 | + PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; |
673 | 635 |
|
674 | 636 | MPM.add(new TargetLibraryInfoWrapperPass(*TLII));
|
675 | 637 |
|
|
0 commit comments