Polly 23.0.0git
ScopDetectionDiagnostic.h
Go to the documentation of this file.
1//===- ScopDetectionDiagnostic.h - Diagnostic for ScopDetection -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Small set of diagnostic helper classes to encapsulate any errors occurred
10// during the detection of Scops.
11//
12// The ScopDetection defines a set of error classes (via Statistic variables)
13// that groups a number of individual errors into a group, e.g. non-affinity
14// related errors.
15// On error we generate an object that carries enough additional information
16// to diagnose the error and generate a helpful error message.
17//
18//===----------------------------------------------------------------------===//
19
20#ifndef POLLY_SCOPDETECTIONDIAGNOSTIC_H
21#define POLLY_SCOPDETECTIONDIAGNOSTIC_H
22
23#include "llvm/Analysis/LoopInfo.h"
24#include "llvm/IR/DebugLoc.h"
25#include "llvm/IR/Instruction.h"
26#include <cstddef>
27
28namespace llvm {
29class AliasSet;
30class BasicBlock;
31class OptimizationRemarkEmitter;
32class Region;
33class SCEV;
34class Type;
35} // namespace llvm
36
37namespace polly {
38using llvm::AliasSet;
39using llvm::BasicBlock;
40using llvm::DebugLoc;
41using llvm::Instruction;
42using llvm::Loop;
43using llvm::OptimizationRemarkEmitter;
44using llvm::raw_ostream;
45using llvm::Region;
46using llvm::SCEV;
47using llvm::SmallVector;
48using llvm::Value;
49
50/// Type to hold region delimiters (entry & exit block).
51using BBPair = std::pair<BasicBlock *, BasicBlock *>;
52
53/// Return the region delimiters (entry & exit block) of @p R.
54BBPair getBBPairForRegion(const Region *R);
55
56/// Set the begin and end source location for the region limited by @p P.
57void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End);
58
59class RejectLog;
60
61/// Emit optimization remarks about the rejected regions to the user.
62///
63/// This emits the content of the reject log as optimization remarks.
64/// Remember to at least track failures (-polly-detect-track-failures).
65/// @param P The region delimiters (entry & exit) we emit remarks for.
66/// @param Log The error log containing all messages being emitted as remark.
67void emitRejectionRemarks(const BBPair &P, const RejectLog &Log,
68 OptimizationRemarkEmitter &ORE);
69
70// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
113
114//===----------------------------------------------------------------------===//
115/// Base class of all reject reasons found during Scop detection.
116///
117/// Subclasses of RejectReason should provide means to capture enough
118/// diagnostic information to help clients figure out what and where something
119/// went wrong in the Scop detection.
121private:
123
124protected:
125 static const DebugLoc Unknown;
126
127public:
129
130 virtual ~RejectReason() = default;
131
132 RejectReasonKind getKind() const { return Kind; }
133
134 /// Generate the remark name to identify this remark.
135 ///
136 /// @return A short string that identifies the error.
137 virtual std::string getRemarkName() const = 0;
138
139 /// Get the Basic Block containing this remark.
140 ///
141 /// @return The Basic Block containing this remark.
142 virtual const BasicBlock *getRemarkBB() const = 0;
143
144 /// Generate a reasonable diagnostic message describing this error.
145 ///
146 /// @return A debug message representing this error.
147 virtual std::string getMessage() const = 0;
148
149 /// Generate a message for the end-user describing this error.
150 ///
151 /// The message provided has to be suitable for the end-user. So it should
152 /// not reference any LLVM internal data structures or terminology.
153 /// Ideally, the message helps the end-user to increase the size of the
154 /// regions amenable to Polly.
155 ///
156 /// @return A short message representing this error.
157 virtual std::string getEndUserMessage() const { return "Unspecified error."; }
158
159 /// Get the source location of this error.
160 ///
161 /// @return The debug location for this error.
162 virtual const DebugLoc &getDebugLoc() const;
163};
164
165using RejectReasonPtr = std::shared_ptr<RejectReason>;
166
167/// Stores all errors that occurred during the detection.
168class RejectLog final {
169 Region *R;
170 SmallVector<RejectReasonPtr, 1> ErrorReports;
171
172public:
173 explicit RejectLog(Region *R) : R(R) {}
174
175 using iterator = SmallVector<RejectReasonPtr, 1>::const_iterator;
176
177 iterator begin() const { return ErrorReports.begin(); }
178 iterator end() const { return ErrorReports.end(); }
179 size_t size() const { return ErrorReports.size(); }
180
181 /// Returns true, if we store at least one error.
182 ///
183 /// @return true, if we store at least one error.
184 bool hasErrors() const { return size() > 0; }
185
186 void print(raw_ostream &OS, int level = 0) const;
187
188 const Region *region() const { return R; }
189 void report(RejectReasonPtr Reject) { ErrorReports.push_back(Reject); }
190};
191
192//===----------------------------------------------------------------------===//
193/// Base class for CFG related reject reasons.
194///
195/// Scop candidates that violate structural restrictions can be grouped under
196/// this reject reason class.
197class ReportCFG : public RejectReason {
198public:
200
201 /// @name LLVM-RTTI interface
202 //@{
203 static bool classof(const RejectReason *RR);
204 //@}
205};
206
207//===----------------------------------------------------------------------===//
208/// Captures bad terminator within a Scop candidate.
209class ReportInvalidTerminator final : public ReportCFG {
210 BasicBlock *BB;
211
212public:
215
216 /// @name LLVM-RTTI interface
217 //@{
218 static bool classof(const RejectReason *RR);
219 //@}
220
221 /// @name RejectReason interface
222 //@{
223 std::string getRemarkName() const override;
224 const BasicBlock *getRemarkBB() const override;
225 std::string getMessage() const override;
226 const DebugLoc &getDebugLoc() const override;
227 //@}
228};
229
230//===----------------------------------------------------------------------===//
231/// Captures irreducible regions in CFG.
232class ReportIrreducibleRegion final : public ReportCFG {
233 Region *R;
234 DebugLoc DbgLoc;
235
236public:
239
240 /// @name LLVM-RTTI interface
241 //@{
242 static bool classof(const RejectReason *RR);
243 //@}
244
245 /// @name RejectReason interface
246 //@{
247 std::string getRemarkName() const override;
248 const BasicBlock *getRemarkBB() const override;
249 std::string getMessage() const override;
250 std::string getEndUserMessage() const override;
251 const DebugLoc &getDebugLoc() const override;
252 //@}
253};
254
255//===----------------------------------------------------------------------===//
256/// Captures regions with an unreachable in the exit block.
257class ReportUnreachableInExit final : public ReportCFG {
258 BasicBlock *BB;
259 DebugLoc DbgLoc;
260
261public:
265
266 /// @name LLVM-RTTI interface
267 //@{
268 static bool classof(const RejectReason *RR);
269 //@}
270
271 /// @name RejectReason interface
272 //@{
273 std::string getRemarkName() const override;
274 const BasicBlock *getRemarkBB() const override;
275 std::string getMessage() const override;
276 std::string getEndUserMessage() const override;
277 const DebugLoc &getDebugLoc() const override;
278 //@}
279};
280
281//===----------------------------------------------------------------------===//
282/// Captures regions with an IndirectBr predecessor.
284 Instruction *Inst;
285 DebugLoc DbgLoc;
286
287public:
291
292 /// @name LLVM-RTTI interface
293 //@{
294 static bool classof(const RejectReason *RR);
295 //@}
296
297 /// @name RejectReason interface
298 //@{
299 std::string getRemarkName() const override;
300 const BasicBlock *getRemarkBB() const override;
301 std::string getMessage() const override;
302 std::string getEndUserMessage() const override;
303 const DebugLoc &getDebugLoc() const override;
304 //@}
305};
306
307//===----------------------------------------------------------------------===//
308/// Base class for non-affine reject reasons.
309///
310/// Scop candidates that violate restrictions to affinity are reported under
311/// this class.
313protected:
314 // The instruction that caused non-affinity to occur.
315 const Instruction *Inst;
316
317public:
318 ReportAffFunc(const RejectReasonKind K, const Instruction *Inst);
319
320 /// @name LLVM-RTTI interface
321 //@{
322 static bool classof(const RejectReason *RR);
323 //@}
324
325 /// @name RejectReason interface
326 //@{
327 const DebugLoc &getDebugLoc() const override { return Inst->getDebugLoc(); }
328 //@}
329};
330
331//===----------------------------------------------------------------------===//
332/// Captures a condition that is based on an 'undef' value.
333class ReportUndefCond final : public ReportAffFunc {
334 // The BasicBlock we found the broken condition in.
335 BasicBlock *BB;
336
337public:
338 ReportUndefCond(const Instruction *Inst, BasicBlock *BB)
340
341 /// @name LLVM-RTTI interface
342 //@{
343 static bool classof(const RejectReason *RR);
344 //@}
345
346 /// @name RejectReason interface
347 //@{
348 std::string getRemarkName() const override;
349 const BasicBlock *getRemarkBB() const override;
350 std::string getMessage() const override;
351 //@}
352};
353
354//===----------------------------------------------------------------------===//
355/// Captures an invalid condition
356///
357/// Conditions have to be either constants or icmp instructions.
358class ReportInvalidCond final : public ReportAffFunc {
359 // The BasicBlock we found the broken condition in.
360 BasicBlock *BB;
361
362public:
363 ReportInvalidCond(const Instruction *Inst, BasicBlock *BB)
365
366 /// @name LLVM-RTTI interface
367 //@{
368 static bool classof(const RejectReason *RR);
369 //@}
370
371 /// @name RejectReason interface
372 //@{
373 std::string getRemarkName() const override;
374 const BasicBlock *getRemarkBB() const override;
375 std::string getMessage() const override;
376 //@}
377};
378
379//===----------------------------------------------------------------------===//
380/// Captures an undefined operand.
381class ReportUndefOperand final : public ReportAffFunc {
382 // The BasicBlock we found the undefined operand in.
383 BasicBlock *BB;
384
385public:
386 ReportUndefOperand(BasicBlock *BB, const Instruction *Inst)
388
389 /// @name LLVM-RTTI interface
390 //@{
391 static bool classof(const RejectReason *RR);
392 //@}
393
394 /// @name RejectReason interface
395 //@{
396 std::string getRemarkName() const override;
397 const BasicBlock *getRemarkBB() const override;
398 std::string getMessage() const override;
399 //@}
400};
401
402//===----------------------------------------------------------------------===//
403/// Captures a non-affine branch.
404class ReportNonAffBranch final : public ReportAffFunc {
405 // The BasicBlock we found the non-affine branch in.
406 BasicBlock *BB;
407
408 /// LHS & RHS of the failed condition.
409 //@{
410 const SCEV *LHS;
411 const SCEV *RHS;
412 //@}
413
414public:
415 ReportNonAffBranch(BasicBlock *BB, const SCEV *LHS, const SCEV *RHS,
416 const Instruction *Inst)
418 RHS(RHS) {}
419
420 const SCEV *lhs() { return LHS; }
421 const SCEV *rhs() { return RHS; }
422
423 /// @name LLVM-RTTI interface
424 //@{
425 static bool classof(const RejectReason *RR);
426 //@}
427
428 /// @name RejectReason interface
429 //@{
430 std::string getRemarkName() const override;
431 const BasicBlock *getRemarkBB() const override;
432 std::string getMessage() const override;
433 //@}
434};
435
436//===----------------------------------------------------------------------===//
437/// Captures a missing base pointer.
438class ReportNoBasePtr final : public ReportAffFunc {
439public:
442
443 /// @name LLVM-RTTI interface
444 //@{
445 static bool classof(const RejectReason *RR);
446 //@}
447
448 /// @name RejectReason interface
449 //@{
450 std::string getRemarkName() const override;
451 const BasicBlock *getRemarkBB() const override;
452 std::string getMessage() const override;
453 //@}
454};
455
456//===----------------------------------------------------------------------===//
457/// Captures an undefined base pointer.
458class ReportUndefBasePtr final : public ReportAffFunc {
459public:
462
463 /// @name LLVM-RTTI interface
464 //@{
465 static bool classof(const RejectReason *RR);
466 //@}
467
468 /// @name RejectReason interface
469 //@{
470 std::string getRemarkName() const override;
471 const BasicBlock *getRemarkBB() const override;
472 std::string getMessage() const override;
473 //@}
474};
475
476//===----------------------------------------------------------------------===//
477/// Captures a base pointer that is not invariant in the region.
479 // The variant base pointer.
481
482public:
486
487 /// @name LLVM-RTTI interface
488 //@{
489 static bool classof(const RejectReason *RR);
490 //@}
491
492 /// @name RejectReason interface
493 //@{
494 std::string getRemarkName() const override;
495 const BasicBlock *getRemarkBB() const override;
496 std::string getMessage() const override;
497 std::string getEndUserMessage() const override;
498 //@}
499};
500
501//===----------------------------------------------------------------------===//
502/// Captures a non-affine access function.
504 // The non-affine access function.
505 const SCEV *AccessFunction;
506
507 // The base pointer of the memory access.
509
510public:
515
516 const SCEV *get() { return AccessFunction; }
517
518 /// @name LLVM-RTTI interface
519 //@{
520 static bool classof(const RejectReason *RR);
521 //@}
522
523 /// @name RejectReason interface
524 //@{
525 std::string getRemarkName() const override;
526 const BasicBlock *getRemarkBB() const override;
527 std::string getMessage() const override;
528 std::string getEndUserMessage() const override;
529 //@}
530};
531
532//===----------------------------------------------------------------------===//
533/// Report array accesses with differing element size.
535 // The base pointer of the memory access.
537
538public:
542
543 /// @name LLVM-RTTI interface
544 //@{
545 static bool classof(const RejectReason *RR);
546 //@}
547
548 /// @name RejectReason interface
549 //@{
550 std::string getRemarkName() const override;
551 const BasicBlock *getRemarkBB() const override;
552 std::string getMessage() const override;
553 std::string getEndUserMessage() const override;
554 //@}
555};
556
557//===----------------------------------------------------------------------===//
558/// Captures errors with non affine loop bounds.
559class ReportLoopBound final : public RejectReason {
560 // The offending loop.
561 Loop *L;
562
563 // The non-affine loop bound.
564 const SCEV *LoopCount;
565
566 // A copy of the offending loop's debug location.
567 const DebugLoc Loc;
568
569public:
570 ReportLoopBound(Loop *L, const SCEV *LoopCount);
571
572 const SCEV *loopCount() { return LoopCount; }
573
574 /// @name LLVM-RTTI interface
575 //@{
576 static bool classof(const RejectReason *RR);
577 //@}
578
579 /// @name RejectReason interface
580 //@{
581 std::string getRemarkName() const override;
582 const BasicBlock *getRemarkBB() const override;
583 std::string getMessage() const override;
584 const DebugLoc &getDebugLoc() const override;
585 std::string getEndUserMessage() const override;
586 //@}
587};
588
589//===----------------------------------------------------------------------===//
590/// Captures errors when loop has no exit.
591class ReportLoopHasNoExit final : public RejectReason {
592 /// The loop that has no exit.
593 Loop *L;
594
595 const DebugLoc Loc;
596
597public:
600 Loc(L->getStartLoc()) {}
601
602 /// @name LLVM-RTTI interface
603 //@{
604 static bool classof(const RejectReason *RR);
605 //@}
606
607 /// @name RejectReason interface
608 //@{
609 std::string getRemarkName() const override;
610 const BasicBlock *getRemarkBB() const override;
611 std::string getMessage() const override;
612 const DebugLoc &getDebugLoc() const override;
613 std::string getEndUserMessage() const override;
614 //@}
615};
616
617//===----------------------------------------------------------------------===//
618/// Captures errors when a loop has multiple exists.
620 /// The loop that has multiple exits.
621 Loop *L;
622
623 const DebugLoc Loc;
624
625public:
629
630 /// @name LLVM-RTTI interface
631 //@{
632 static bool classof(const RejectReason *RR);
633 //@}
634
635 /// @name RejectReason interface
636 //@{
637 std::string getRemarkName() const override;
638 const BasicBlock *getRemarkBB() const override;
639 std::string getMessage() const override;
640 const DebugLoc &getDebugLoc() const override;
641 std::string getEndUserMessage() const override;
642 //@}
643};
644
645//===----------------------------------------------------------------------===//
646/// Captures errors when not all loop latches are part of the scop.
648 /// The loop for which not all loop latches are part of the scop.
649 Loop *L;
650
651 const DebugLoc Loc;
652
653public:
657
658 /// @name LLVM-RTTI interface
659 //@{
660 static bool classof(const RejectReason *RR);
661 //@}
662
663 /// @name RejectReason interface
664 //@{
665 std::string getRemarkName() const override;
666 const BasicBlock *getRemarkBB() const override;
667 std::string getMessage() const override;
668 const DebugLoc &getDebugLoc() const override;
669 std::string getEndUserMessage() const override;
670 //@}
671};
672
673//===----------------------------------------------------------------------===//
674/// Captures errors with non-side-effect-known function calls.
675class ReportFuncCall final : public RejectReason {
676 // The offending call instruction.
677 Instruction *Inst;
678
679public:
680 ReportFuncCall(Instruction *Inst);
681
682 /// @name LLVM-RTTI interface
683 //@{
684 static bool classof(const RejectReason *RR);
685 //@}
686
687 /// @name RejectReason interface
688 //@{
689 std::string getRemarkName() const override;
690 const BasicBlock *getRemarkBB() const override;
691 std::string getMessage() const override;
692 const DebugLoc &getDebugLoc() const override;
693 std::string getEndUserMessage() const override;
694 //@}
695};
696
697//===----------------------------------------------------------------------===//
698/// Captures errors with aliasing.
699class ReportAlias final : public RejectReason {
700public:
701 using PointerSnapshotTy = std::vector<const Value *>;
702
703private:
704 /// Format an invalid alias set.
705 ///
706 // @param Prefix A prefix string to put before the list of aliasing pointers.
707 // @param Suffix A suffix string to put after the list of aliasing pointers.
708 std::string formatInvalidAlias(std::string Prefix = "",
709 std::string Suffix = "") const;
710
711 Instruction *Inst;
712
713 // A snapshot of the llvm values that took part in the aliasing error.
715
716public:
717 ReportAlias(Instruction *Inst, AliasSet &AS);
718
719 const PointerSnapshotTy &getPointers() const { return Pointers; }
720
721 /// @name LLVM-RTTI interface
722 //@{
723 static bool classof(const RejectReason *RR);
724 //@}
725
726 /// @name RejectReason interface
727 //@{
728 std::string getRemarkName() const override;
729 const BasicBlock *getRemarkBB() const override;
730 std::string getMessage() const override;
731 const DebugLoc &getDebugLoc() const override;
732 std::string getEndUserMessage() const override;
733 //@}
734};
735
736//===----------------------------------------------------------------------===//
737/// Base class for otherwise ungrouped reject reasons.
738class ReportOther : public RejectReason {
739public:
741
742 /// @name LLVM-RTTI interface
743 //@{
744 static bool classof(const RejectReason *RR);
745 //@}
746
747 /// @name RejectReason interface
748 //@{
749 std::string getRemarkName() const override;
750 std::string getMessage() const override;
751 //@}
752};
753
754//===----------------------------------------------------------------------===//
755/// Captures errors with bad IntToPtr instructions.
756class ReportIntToPtr final : public ReportOther {
757 // The offending base value.
758 Instruction *BaseValue;
759
760public:
761 ReportIntToPtr(Instruction *BaseValue);
762
763 /// @name LLVM-RTTI interface
764 //@{
765 static bool classof(const RejectReason *RR);
766 //@}
767
768 /// @name RejectReason interface
769 //@{
770 std::string getRemarkName() const override;
771 const BasicBlock *getRemarkBB() const override;
772 std::string getMessage() const override;
773 const DebugLoc &getDebugLoc() const override;
774 //@}
775};
776
777//===----------------------------------------------------------------------===//
778/// Captures errors with alloca instructions.
779class ReportAlloca final : public ReportOther {
780 Instruction *Inst;
781
782public:
783 ReportAlloca(Instruction *Inst);
784
785 /// @name LLVM-RTTI interface
786 //@{
787 static bool classof(const RejectReason *RR);
788 //@}
789
790 /// @name RejectReason interface
791 //@{
792 std::string getRemarkName() const override;
793 const BasicBlock *getRemarkBB() const override;
794 std::string getMessage() const override;
795 const DebugLoc &getDebugLoc() const override;
796 //@}
797};
798
799//===----------------------------------------------------------------------===//
800/// Captures errors with unknown instructions.
801class ReportUnknownInst final : public ReportOther {
802 Instruction *Inst;
803
804public:
805 ReportUnknownInst(Instruction *Inst);
806
807 /// @name LLVM-RTTI interface
808 //@{
809 static bool classof(const RejectReason *RR);
810 //@}
811
812 /// @name RejectReason interface
813 //@{
814 std::string getRemarkName() const override;
815 const BasicBlock *getRemarkBB() const override;
816 std::string getMessage() const override;
817 const DebugLoc &getDebugLoc() const override;
818 //@}
819};
820
821//===----------------------------------------------------------------------===//
822/// Captures errors with regions containing the function entry block.
823class ReportEntry final : public ReportOther {
824 BasicBlock *BB;
825
826public:
827 ReportEntry(BasicBlock *BB);
828
829 /// @name LLVM-RTTI interface
830 //@{
831 static bool classof(const RejectReason *RR);
832 //@}
833
834 /// @name RejectReason interface
835 //@{
836 std::string getRemarkName() const override;
837 const BasicBlock *getRemarkBB() const override;
838 std::string getMessage() const override;
839 std::string getEndUserMessage() const override;
840 const DebugLoc &getDebugLoc() const override;
841 //@}
842};
843
844//===----------------------------------------------------------------------===//
845/// Report regions that seem not profitable to be optimized.
846class ReportUnprofitable final : public ReportOther {
847 Region *R;
848
849public:
850 ReportUnprofitable(Region *R);
851
852 /// @name LLVM-RTTI interface
853 //@{
854 static bool classof(const RejectReason *RR);
855 //@}
856
857 /// @name RejectReason interface
858 //@{
859 std::string getRemarkName() const override;
860 const BasicBlock *getRemarkBB() const override;
861 std::string getMessage() const override;
862 std::string getEndUserMessage() const override;
863 const DebugLoc &getDebugLoc() const override;
864 //@}
865};
866
867//===----------------------------------------------------------------------===//
868/// Captures errors with non-simple memory accesses.
870 // The offending call instruction.
871 Instruction *Inst;
872
873public:
874 ReportNonSimpleMemoryAccess(Instruction *Inst);
875
876 /// @name LLVM-RTTI interface
877 //@{
878 static bool classof(const RejectReason *RR);
879 //@}
880
881 /// @name RejectReason interface
882 //@{
883 std::string getRemarkName() const override;
884 const BasicBlock *getRemarkBB() const override;
885 std::string getMessage() const override;
886 const DebugLoc &getDebugLoc() const override;
887 std::string getEndUserMessage() const override;
888 //@}
889};
890
891//===----------------------------------------------------------------------===//
892/// Captures types that Polly does not support
894 // The offending call instruction.
895 Instruction *Inst;
896 llvm::Type *Ty;
897
898public:
899 ReportIncompatibleType(Instruction *Inst, llvm::Type *Ty);
900
901 /// @name LLVM-RTTI interface
902 //@{
903 static bool classof(const RejectReason *RR);
904 //@}
905
906 /// @name RejectReason interface
907 //@{
908 std::string getRemarkName() const override;
909 const BasicBlock *getRemarkBB() const override;
910 std::string getMessage() const override;
911 const DebugLoc &getDebugLoc() const override;
912 std::string getEndUserMessage() const override;
913 //@}
914};
915
916} // namespace polly
917
918#endif // POLLY_SCOPDETECTIONDIAGNOSTIC_H
Stores all errors that occurred during the detection.
void report(RejectReasonPtr Reject)
void print(raw_ostream &OS, int level=0) const
const Region * region() const
bool hasErrors() const
Returns true, if we store at least one error.
SmallVector< RejectReasonPtr, 1 >::const_iterator iterator
SmallVector< RejectReasonPtr, 1 > ErrorReports
Base class of all reject reasons found during Scop detection.
virtual std::string getRemarkName() const =0
Generate the remark name to identify this remark.
virtual std::string getMessage() const =0
Generate a reasonable diagnostic message describing this error.
const RejectReasonKind Kind
static const DebugLoc Unknown
virtual const BasicBlock * getRemarkBB() const =0
Get the Basic Block containing this remark.
virtual ~RejectReason()=default
RejectReason(RejectReasonKind K)
virtual std::string getEndUserMessage() const
Generate a message for the end-user describing this error.
RejectReasonKind getKind() const
virtual const DebugLoc & getDebugLoc() const
Get the source location of this error.
static bool classof(const RejectReason *RR)
ReportAffFunc(const RejectReasonKind K, const Instruction *Inst)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
const PointerSnapshotTy & getPointers() const
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::vector< const Value * > PointerSnapshotTy
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string formatInvalidAlias(std::string Prefix="", std::string Suffix="") const
Format an invalid alias set.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportAlias(Instruction *Inst, AliasSet &AS)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
ReportCFG(const RejectReasonKind K)
static bool classof(const RejectReason *RR)
ReportDifferentArrayElementSize(const Instruction *Inst, const Value *V)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportIncompatibleType(Instruction *Inst, llvm::Type *Ty)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportIndirectPredecessor(Instruction *Inst, DebugLoc DbgLoc)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportIntToPtr(Instruction *BaseValue)
ReportInvalidCond(const Instruction *Inst, BasicBlock *BB)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
ReportIrreducibleRegion(Region *R, DebugLoc DbgLoc)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportLoopBound(Loop *L, const SCEV *LoopCount)
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
Loop * L
The loop that has multiple exits.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
Loop * L
The loop that has no exit.
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
Loop * L
The loop for which not all loop latches are part of the scop.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
static bool classof(const RejectReason *RR)
ReportNoBasePtr(const Instruction *Inst)
ReportNonAffBranch(BasicBlock *BB, const SCEV *LHS, const SCEV *RHS, const Instruction *Inst)
const SCEV * LHS
LHS & RHS of the failed condition.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
ReportNonAffineAccess(const SCEV *AccessFunction, const Instruction *Inst, const Value *V)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
ReportOther(const RejectReasonKind K)
ReportUndefBasePtr(const Instruction *Inst)
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportUndefCond(const Instruction *Inst, BasicBlock *BB)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportUndefOperand(BasicBlock *BB, const Instruction *Inst)
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportUnreachableInExit(BasicBlock *BB, DebugLoc DbgLoc)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
ReportVariantBasePtr(Value *BaseValue, const Instruction *Inst)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::shared_ptr< RejectReason > RejectReasonPtr
void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End)
Set the begin and end source location for the region limited by P.
@ Value
MemoryKind::Value: Models an llvm::Value.
Definition ScopInfo.h:149
void emitRejectionRemarks(const BBPair &P, const RejectLog &Log, OptimizationRemarkEmitter &ORE)
Emit optimization remarks about the rejected regions to the user.
BBPair getBBPairForRegion(const Region *R)
Return the region delimiters (entry & exit block) of R.
std::pair< llvm::BasicBlock *, llvm::BasicBlock * > BBPair
Type to hold region delimiters (entry & exit block).
Definition Utils.h:31