[PATCH] D55690: [TransformWarning] Do not warn missed transformations in optnone functions.
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 14 11:49:05 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349184: [TransformWarning] Do not warn missed transformations in optnone functions. (authored by Meinersbur, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D55690?vs=178174&id=178263#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55690/new/
https://reviews.llvm.org/D55690
Files:
llvm/trunk/lib/Transforms/Scalar/WarnMissedTransforms.cpp
llvm/trunk/test/Transforms/LoopTransformWarning/optnone.ll
Index: llvm/trunk/test/Transforms/LoopTransformWarning/optnone.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopTransformWarning/optnone.ll
+++ llvm/trunk/test/Transforms/LoopTransformWarning/optnone.ll
@@ -0,0 +1,50 @@
+; Legacy pass manager
+; RUN: opt -transform-warning -disable-output -pass-remarks-missed=transform-warning -pass-remarks-analysis=transform-warning < %s 2>&1 | FileCheck -allow-empty %s
+;
+; New pass manager
+; RUN: opt -passes=transform-warning -disable-output -pass-remarks-missed=transform-warning -pass-remarks-analysis=transform-warning < %s 2>&1 | FileCheck -allow-empty %s
+;
+; Verify that no transformation warnings are emitted for functions with
+; 'optnone' attribute.
+;
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @func(i32* nocapture %A, i32* nocapture readonly %B, i32 %Length) #0 {
+entry:
+ %cmp9 = icmp sgt i32 %Length, 0
+ br i1 %cmp9, label %for.body.preheader, label %for.end
+
+for.body.preheader:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
+ %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv
+ %0 = load i32, i32* %arrayidx, align 4
+ %idxprom1 = sext i32 %0 to i64
+ %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1
+ %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
+ store i32 %1, i32* %arrayidx4, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %Length
+ br i1 %exitcond, label %for.end.loopexit, label %for.body, !llvm.loop !0
+
+for.end.loopexit:
+ br label %for.end
+
+for.end:
+ ret void
+}
+
+attributes #0 = { noinline optnone }
+
+!0 = distinct !{!0, !1, !2, !3}
+!1 = !{!"llvm.loop.unroll.enable"}
+!2 = !{!"llvm.loop.distribute.enable"}
+!3 = !{!"llvm.loop.unroll_and_jam.enable"}
+!4 = !{!"llvm.loop.vectorize.enable", i1 true}
+
+
+; CHECK-NOT: warning
Index: llvm/trunk/lib/Transforms/Scalar/WarnMissedTransforms.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/WarnMissedTransforms.cpp
+++ llvm/trunk/lib/Transforms/Scalar/WarnMissedTransforms.cpp
@@ -91,6 +91,11 @@
// New pass manager boilerplate
PreservedAnalyses
WarnMissedTransformationsPass::run(Function &F, FunctionAnalysisManager &AM) {
+ // Do not warn about not applied transformations if optimizations are
+ // disabled.
+ if (F.hasFnAttribute(Attribute::OptimizeNone))
+ return PreservedAnalyses::all();
+
auto &ORE = AM.getResult<OptimizationRemarkEmitterAnalysis>(F);
auto &LI = AM.getResult<LoopAnalysis>(F);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55690.178263.patch
Type: text/x-patch
Size: 2788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181214/ddf7846c/attachment.bin>
More information about the llvm-commits
mailing list