~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/LICM/extra-copies.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt < %s -licm -S | FileCheck %s
 
2
; PR19835
 
3
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
4
target triple = "x86_64-unknown-linux-gnu"
 
5
 
 
6
define i32 @f(i32 %x) {
 
7
entry:
 
8
  br label %for.body
 
9
 
 
10
for.body:                                         ; preds = %entry, %for.body
 
11
  %storemerge4 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
 
12
  %mul = mul nsw i32 %x, %x
 
13
  %add2 = add nsw i32 %mul, %x
 
14
  %mul3 = add nsw i32 %add2, %mul
 
15
  %inc = add nsw i32 %storemerge4, 1
 
16
  %cmp = icmp slt i32 %inc, 100
 
17
  br i1 %cmp, label %for.body, label %for.end
 
18
 
 
19
for.end:                                          ; preds = %for.body
 
20
  %a9.0.lcssa = phi i32 [ %mul3, %for.body ]
 
21
  ret i32 %a9.0.lcssa
 
22
}
 
23
 
 
24
; Test that there is exactly one copy of mul nsw i32 %x, %x in the exit block.
 
25
; CHECK: define i32 @f(i32 [[X:%.*]])
 
26
; CHECK: for.end:
 
27
; CHECK-NOT: mul nsw i32 [[X]], [[X]]
 
28
; CHECK: mul nsw i32 [[X]], [[X]]
 
29
; CHECK-NOT: mul nsw i32 [[X]], [[X]]