[PATCH] D33768: [Polly] Exclude Ignored Intrinsics from explicit instruction list

Nandini Singhal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 08:30:52 PDT 2017


nandini12396 updated this revision to Diff 101029.
nandini12396 marked an inline comment as done.
nandini12396 added a comment.

Addressed Michael Sir's comments.


https://reviews.llvm.org/D33768

Files:
  lib/Analysis/ScopBuilder.cpp
  test/ScopInfo/intrinsics.ll


Index: test/ScopInfo/intrinsics.ll
===================================================================
--- /dev/null
+++ test/ScopInfo/intrinsics.ll
@@ -0,0 +1,51 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-print-instructions < %s | FileCheck %s
+;
+; Verify that we remove the ignored intrinsics from the instruction list.
+;
+; CHECK: store i32 %i.0, i32* %arrayidx, align 4
+;
+;    int A[1024];
+;    void func() {
+;      for (int i = 0; i < 1024; i++)
+;          A[i] = i;
+;    }
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: noinline nounwind uwtable
+define void @func() #0 {
+entry:
+  %A = alloca [1024 x i32], align 16
+  %i = alloca i32, align 4
+  store i32 0, i32* %i, align 4
+  br label %for.cond
+
+  for.cond:                                         ; preds = %for.inc, %entry
+  %tmp = load i32, i32* %i, align 4
+  %cmp = icmp slt i32 %tmp, 1024
+  br i1 %cmp, label %for.body, label %for.end
+
+  for.body:                                         ; preds = %for.cond
+  %tmp1 = load i32, i32* %i, align 4
+  %tmp2 = load i32, i32* %i, align 4
+  %idxprom = sext i32 %tmp2 to i64
+  %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* %A, i64 0, i64 %idxprom
+  call void @llvm.donothing()
+  store i32 %tmp1, i32* %arrayidx, align 4
+  br label %for.inc
+
+  for.inc:                                          ; preds = %for.body
+  %tmp3 = load i32, i32* %i, align 4
+  %inc = add nsw i32 %tmp3, 1
+  store i32 %inc, i32* %i, align 4
+  br label %for.cond
+
+  for.end:                                          ; preds = %for.cond
+  ret void
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.donothing() #1
+
+attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
Index: lib/Analysis/ScopBuilder.cpp
===================================================================
--- lib/Analysis/ScopBuilder.cpp
+++ lib/Analysis/ScopBuilder.cpp
@@ -642,7 +642,8 @@
       std::vector<Instruction *> Instructions;
       for (Instruction &Inst : *I->getNodeAs<BasicBlock>()) {
         Loop *L = LI.getLoopFor(Inst.getParent());
-        if (!isa<TerminatorInst>(&Inst) && !canSynthesize(&Inst, *scop, &SE, L))
+        if (!isa<TerminatorInst>(&Inst) && !isIgnoredIntrinsic(&Inst) &&
+              !canSynthesize(&Inst, *scop, &SE, L))
           Instructions.push_back(&Inst);
       }
       Loop *SurroundingLoop = LI.getLoopFor(I->getNodeAs<BasicBlock>());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33768.101029.patch
Type: text/x-patch
Size: 2940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/679c467e/attachment-0001.bin>


More information about the llvm-commits mailing list