[PATCH] D11769: [LoopUnswitch] Preserve make.implicit metadata for unswitched conditions

Chen Li meloli87 at gmail.com
Wed Aug 5 11:19:49 PDT 2015


chenli updated this revision to Diff 31380.
chenli added a comment.

Updated w.r.t Chad's comments.


http://reviews.llvm.org/D11769

Files:
  lib/Transforms/Scalar/LoopUnswitch.cpp
  test/Transforms/LoopUnswitch/copy-metadata.ll

Index: test/Transforms/LoopUnswitch/copy-metadata.ll
===================================================================
--- /dev/null
+++ test/Transforms/LoopUnswitch/copy-metadata.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -loop-unswitch -S < %s 2>&1 | FileCheck %s
+
+; This test checks if unswitched condition preserve make.implicit metadata.
+
+define i32 @test(i1 %cond) {
+; CHECK: br i1 %cond, label %..split_crit_edge, label %.loop_exit.split_crit_edge, !make.implicit !0
+  br label %loop_begin
+
+loop_begin:
+; CHECK: br i1 true, label %continue, label %loop_exit, !make.implicit !0
+  br i1 %cond, label %continue, label %loop_exit, !make.implicit !0
+
+continue:
+  call void @some_func()
+  br label %loop_begin
+
+loop_exit:
+  ret i32 0
+}
+
+declare void @some_func()
+
+!0 = !{}
Index: lib/Transforms/Scalar/LoopUnswitch.cpp
===================================================================
--- lib/Transforms/Scalar/LoopUnswitch.cpp
+++ lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -656,6 +656,7 @@
         }
       }
       // fallthrough.
+    case LLVMContext::MD_make_implicit:
     case LLVMContext::MD_dbg:
       DstInst->setMetadata(MD.first, MD.second);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11769.31380.patch
Type: text/x-patch
Size: 1184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150805/6d644c05/attachment.bin>


More information about the llvm-commits mailing list