summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPreston Gurd <preston.gurd@intel.com>2013-04-02 14:25:06 +0000
committerPreston Gurd <preston.gurd@intel.com>2013-04-02 14:25:06 +0000
commite97f84e991f64640cc60bf5a5b20071845b08429 (patch)
tree7c367e3fac6d8b1ed88c667952c10227204e3012 /test
parentd4ab1926af982e4334978fd9bf9156c7c087f6f5 (diff)
downloadllvm-e97f84e991f64640cc60bf5a5b20071845b08429.tar.gz
llvm-e97f84e991f64640cc60bf5a5b20071845b08429.tar.bz2
llvm-e97f84e991f64640cc60bf5a5b20071845b08429.tar.xz
Simplify test cases for Atom preferring call register indirect over
call memory indirect (32 and 64 bit). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll273
-rw-r--r--test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll296
2 files changed, 160 insertions, 409 deletions
diff --git a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
index 4192f13d89..2a34e0298f 100644
--- a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
+++ b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
@@ -1,204 +1,77 @@
; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=atom 2>&1 | \
; RUN: grep "calll" | not grep "("
; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=core2 2>&1 | \
-; RUN: grep "calll" | grep "4-byte Folded Reload"
-
-%struct.targettype = type {i32}
-%struct.op_ptr1 = type opaque
-%struct.op_ptr2 = type opaque
-%union.anon = type { [8 x i32], [48 x i8] }
-%struct.const1 = type { [64 x i16], i8 }
-%struct.const2 = type { [17 x i8], [256 x i8], i8 }
-
-%struct.ref1 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, void (%struct.ref2*)*, i32 (%struct.ref2*, i8***)*, %struct.op_ptr2** }
-%struct.ref2 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32, %struct.localref11*, i32, i32, i32, i32, i32, i32, i32, double, i8, i8, i32, i8, i8, i8, i32, i8, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, i8**, i32, i32, i32, i32, i32, [64 x i32]*, [4 x %struct.const1*], [4 x %struct.const2*], [4 x %struct.const2*], i32, %struct.ref3*, i8, i8, [16 x i8], [16 x i8], [16 x i8], i32, i8, i8, i8, i8, i16, i16, i8, i8, i8, %struct.localref10*, i32, i32, i32, i32, i8*, i32, [4 x %struct.ref3*], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, %struct.localref8*, %struct.localref9*, %struct.ref1*, %struct.localref7*, %struct.localref6*, %struct.localref5*, %struct.localref1*, %struct.ref4*, %struct.localref2*, %struct.localref3*, %struct.localref4* }
-%struct.ref3 = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, %struct.const1*, i8* }
-%struct.ref4 = type { void (%struct.ref2*)*, [5 x void (%struct.ref2*, %struct.ref3*, i16*, i8**, i32)*] }
-
-%struct.localref1 = type { void (%struct.ref2*)*, i8 (%struct.ref2*, [64 x i16]**)*, i8 }
-%struct.localref2 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)*, i8 }
-%struct.localref3 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32, i8**, i32)* }
-%struct.localref4 = type { {}*, void (%struct.ref2*, i8**, i8**, i32)*, void (%struct.ref2*)*, void (%struct.ref2*)* }
-%struct.localref5 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, i8 (%struct.ref2*)*, i8, i8, i32, i32 }
-%struct.localref6 = type { i32 (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, i8, i8 }
-%struct.localref7 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)* }
-%struct.localref8 = type { void (%struct.ref2*)*, void (%struct.ref2*)*, i8 }
-%struct.localref9 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8**, i32*, i32)* }
-%struct.localref10 = type { %struct.localref10*, i8, i32, i32, i8* }
-%struct.localref11 = type { i8*, %struct.targettype, void (%struct.ref2*)*, i8 (%struct.ref2*)*, void (%struct.ref2*, %struct.targettype)*, i8 (%struct.ref2*, i32)*, void (%struct.ref2*)* }
-%struct.localref12 = type { {}*, %struct.targettype, %struct.targettype, i32, i32 }
-%struct.localref13 = type { void (%struct.localref14*)*, void (%struct.localref14*, i32)*, void (%struct.localref14*)*, void (%struct.localref14*, i8*)*, void (%struct.localref14*)*, i32, %union.anon, i32, %struct.targettype, i8**, i32, i8**, i32, i32 }
-%struct.localref14 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32 }
-%struct.localref15 = type { i8* (%struct.localref14*, i32, %struct.targettype)*, i8* (%struct.localref14*, i32, %struct.targettype)*, i8** (%struct.localref14*, i32, i32, i32)*, [64 x i16]** (%struct.localref14*, i32, i32, i32)*, %struct.op_ptr1* (%struct.localref14*, i32, i8, i32, i32, i32)*, %struct.op_ptr2* (%struct.localref14*, i32, i8, i32, i32, i32)*, {}*, i8** (%struct.localref14*, %struct.op_ptr1*, i32, i32, i8)*, [64 x i16]** (%struct.localref14*, %struct.op_ptr2*, i32, i32, i8)*, void (%struct.localref14*, i32)*, {}*, %struct.targettype, %struct.targettype}
-
-define internal i32 @foldedreload(%struct.ref2* %cinfo, i8*** nocapture %output1) {
- %1 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 79
- %2 = load %struct.ref1** %1, align 4
- %3 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 68
- %4 = load i32* %3, align 4
- %5 = add i32 %4, -1
- %6 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 64
- %7 = load i32* %6, align 4
- %8 = add i32 %7, -1
- %9 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 1
- %10 = bitcast i32 (%struct.ref2*)** %9 to i32*
- %11 = load i32* %10, align 4
- %12 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 2
- %13 = bitcast void (%struct.ref2*)** %12 to i32*
- %14 = load i32* %13, align 4
- %15 = icmp slt i32 %11, %14
- br i1 %15, label %.lr.ph18, label %._crit_edge19
-
-.lr.ph18:
- %16 = getelementptr inbounds %struct.ref1* %2, i32 1
- %17 = bitcast %struct.ref1* %16 to i32*
- %18 = getelementptr inbounds %struct.ref1* %16, i32 0, i32 0
- %19 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 66
- %20 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 84
- %21 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 36
- %22 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 3
- %23 = bitcast i32 (%struct.ref2*, i8***)** %22 to [10 x [64 x i16]*]*
- %.pre = load i32* %17, align 4
- br label %24
-
-; <label>:24
- %25 = phi i32 [ %14, %.lr.ph18 ], [ %89, %88 ]
- %26 = phi i32 [ %.pre, %.lr.ph18 ], [ 0, %88 ]
- %var1.015 = phi i32 [ %11, %.lr.ph18 ], [ %90, %88 ]
- %27 = icmp ugt i32 %26, %5
- br i1 %27, label %88, label %.preheader7.lr.ph
-
-.preheader7.lr.ph:
- %.pre24 = load i32* %19, align 4
- br label %.preheader7
-
-.preheader7:
- %28 = phi i32 [ %.pre24, %.preheader7.lr.ph ], [ %85, %._crit_edge11 ]
- %var2.012 = phi i32 [ %26, %.preheader7.lr.ph ], [ %86, %._crit_edge11 ]
- %29 = icmp sgt i32 %28, 0
- br i1 %29, label %.lr.ph10, label %._crit_edge11
-
-.lr.ph10:
- %30 = phi i32 [ %28, %.preheader7 ], [ %82, %81 ]
- %var4.09 = phi i32 [ 0, %.preheader7 ], [ %var4.1.lcssa, %81 ]
- %ci.08 = phi i32 [ 0, %.preheader7 ], [ %83, %81 ]
- %31 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 67, i32 %ci.08
- %32 = load %struct.ref3** %31, align 4
- %33 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 1
- %34 = load i32* %33, align 4
- %35 = load %struct.ref4** %20, align 4
- %36 = getelementptr inbounds %struct.ref4* %35, i32 0, i32 1, i32 %34
- %37 = load void (%struct.ref2*, %struct.ref3*, i16*, i8**, i32)** %36, align 4
- %38 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 17
- %39 = load i32* %38, align 4
- %40 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 9
- %41 = load i32* %40, align 4
- %42 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 16
- %43 = load i32* %42, align 4
- %44 = mul i32 %43, %var2.012
- %45 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 14
- %46 = load i32* %45, align 4
- %47 = icmp sgt i32 %46, 0
- br i1 %47, label %.lr.ph6, label %81
-
-.lr.ph6:
- %48 = getelementptr inbounds i8*** %output1, i32 %34
- %49 = mul nsw i32 %41, %var1.015
- %50 = load i8*** %48, align 4
- %51 = getelementptr inbounds i8** %50, i32 %49
- %52 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 13
- %53 = getelementptr inbounds %struct.ref3* %32, i32 0, i32 18
- %54 = icmp sgt i32 %39, 0
- br i1 %54, label %.lr.ph6.split.us, label %.lr.ph6..lr.ph6.split_crit_edge
-
-.lr.ph6..lr.ph6.split_crit_edge:
- br label %._crit_edge26
-
-.lr.ph6.split.us:
- %55 = phi i32 [ %63, %._crit_edge28 ], [ %46, %.lr.ph6 ]
- %56 = phi i32 [ %64, %._crit_edge28 ], [ %41, %.lr.ph6 ]
- %var4.15.us = phi i32 [ %66, %._crit_edge28 ], [ %var4.09, %.lr.ph6 ]
- %output2.04.us = phi i8** [ %69, %._crit_edge28 ], [ %51, %.lr.ph6 ]
- %var5.03.us = phi i32 [ %67, %._crit_edge28 ], [ 0, %.lr.ph6 ]
- %57 = load i32* %21, align 4
- %58 = icmp ult i32 %57, %8
- br i1 %58, label %.lr.ph.us, label %59
-
-; <label>:59
- %60 = add nsw i32 %var5.03.us, %var1.015
- %61 = load i32* %53, align 4
- %62 = icmp slt i32 %60, %61
- br i1 %62, label %.lr.ph.us, label %._crit_edge27
-
-._crit_edge27:
- %63 = phi i32 [ %.pre23.pre, %.loopexit.us ], [ %55, %59 ]
- %64 = phi i32 [ %74, %.loopexit.us ], [ %56, %59 ]
- %65 = load i32* %52, align 4
- %66 = add nsw i32 %65, %var4.15.us
- %67 = add nsw i32 %var5.03.us, 1
- %68 = icmp slt i32 %67, %63
- br i1 %68, label %._crit_edge28, label %._crit_edge
-
-._crit_edge28:
- %69 = getelementptr inbounds i8** %output2.04.us, i32 %64
- br label %.lr.ph6.split.us
-
-.lr.ph.us:
- %var3.02.us = phi i32 [ %75, %.lr.ph.us ], [ %44, %.lr.ph6.split.us ], [ %44, %59 ]
- %xindex.01.us = phi i32 [ %76, %.lr.ph.us ], [ 0, %.lr.ph6.split.us ], [ 0, %59 ]
- %70 = add nsw i32 %xindex.01.us, %var4.15.us
- %71 = getelementptr inbounds [10 x [64 x i16]*]* %23, i32 0, i32 %70
- %72 = load [64 x i16]** %71, align 4
- %73 = getelementptr inbounds [64 x i16]* %72, i32 0, i32 0
- tail call void %37(%struct.ref2* %cinfo, %struct.ref3* %32, i16* %73, i8** %output2.04.us, i32 %var3.02.us) nounwind
- %74 = load i32* %40, align 4
- %75 = add i32 %74, %var3.02.us
- %76 = add nsw i32 %xindex.01.us, 1
- %exitcond = icmp eq i32 %76, %39
- br i1 %exitcond, label %.loopexit.us, label %.lr.ph.us
-
-.loopexit.us:
- %.pre23.pre = load i32* %45, align 4
- br label %._crit_edge27
-
-._crit_edge26:
- %var4.15 = phi i32 [ %var4.09, %.lr.ph6..lr.ph6.split_crit_edge ], [ %78, %._crit_edge26 ]
- %var5.03 = phi i32 [ 0, %.lr.ph6..lr.ph6.split_crit_edge ], [ %79, %._crit_edge26 ]
- %77 = load i32* %52, align 4
- %78 = add nsw i32 %77, %var4.15
- %79 = add nsw i32 %var5.03, 1
- %80 = icmp slt i32 %79, %46
- br i1 %80, label %._crit_edge26, label %._crit_edge
-
-._crit_edge:
- %split = phi i32 [ %66, %._crit_edge27 ], [ %78, %._crit_edge26 ]
- %.pre25 = load i32* %19, align 4
- br label %81
-
-; <label>:81
- %82 = phi i32 [ %.pre25, %._crit_edge ], [ %30, %.lr.ph10 ]
- %var4.1.lcssa = phi i32 [ %split, %._crit_edge ], [ %var4.09, %.lr.ph10 ]
- %83 = add nsw i32 %ci.08, 1
- %84 = icmp slt i32 %83, %82
- br i1 %84, label %.lr.ph10, label %._crit_edge11
-
-._crit_edge11:
- %85 = phi i32 [ %28, %.preheader7 ], [ %82, %81 ]
- %86 = add i32 %var2.012, 1
- %87 = icmp ugt i32 %86, %5
- br i1 %87, label %._crit_edge14, label %.preheader7
-
-._crit_edge14:
- %.pre21 = load i32* %13, align 4
- br label %88
-
-; <label>:88
- %89 = phi i32 [ %.pre21, %._crit_edge14 ], [ %25, %24 ]
- store void (%struct.ref2*)* null, void (%struct.ref2*)** %18, align 4
- %90 = add nsw i32 %var1.015, 1
- %91 = icmp slt i32 %90, %89
- br i1 %91, label %24, label %._crit_edge19
-
-._crit_edge19:
- ret i32 3
+; RUN: grep "calll" | grep "*funcp"
+;
+; original source code built with clang -S -emit-llvm -M32 test32.c:
+;
+; int a, b, c, d, e, f, g, h, i, j;
+; extern int (*funcp)(int, int, int, int, int, int, int, int);
+; extern int sum;
+;
+; void func()
+; {
+; sum = 0;
+; for( i = a; i < b; ++i )
+; {
+; sum += (*funcp)(i, b, c, d, e, f, g, h);
+; }
+; }
+;
+; ModuleID = 'test32.c'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-unknown-linux-gnu"
+
+@sum = external global i32
+@a = common global i32 0, align 4
+@i = common global i32 0, align 4
+@b = common global i32 0, align 4
+@funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32)*
+@c = common global i32 0, align 4
+@d = common global i32 0, align 4
+@e = common global i32 0, align 4
+@f = common global i32 0, align 4
+@g = common global i32 0, align 4
+@h = common global i32 0, align 4
+@j = common global i32 0, align 4
+
+define void @func() #0 {
+entry:
+ store i32 0, i32* @sum, align 4
+ %0 = load i32* @a, align 4
+ store i32 %0, i32* @i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %1 = load i32* @i, align 4
+ %2 = load i32* @b, align 4
+ %cmp = icmp slt i32 %1, %2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %3 = load i32 (i32, i32, i32, i32, i32, i32, i32, i32)** @funcp, align 4
+ %4 = load i32* @i, align 4
+ %5 = load i32* @b, align 4
+ %6 = load i32* @c, align 4
+ %7 = load i32* @d, align 4
+ %8 = load i32* @e, align 4
+ %9 = load i32* @f, align 4
+ %10 = load i32* @g, align 4
+ %11 = load i32* @h, align 4
+ %call = call i32 %3(i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11)
+ %12 = load i32* @sum, align 4
+ %add = add nsw i32 %12, %call
+ store i32 %add, i32* @sum, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %13 = load i32* @i, align 4
+ %inc = add nsw i32 %13, 1
+ store i32 %inc, i32* @i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
}
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
index a7f249aae3..bcfbd6107a 100644
--- a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
+++ b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
@@ -1,213 +1,91 @@
; RUN: llc < %s -mtriple=x86_64-linux-gnu -mcpu=atom 2>&1 | \
; RUN: grep "callq" | not grep "("
; RUN: llc < %s -mtriple=x86_64-linux-gnu -mcpu=core2 2>&1 | \
-; RUN: grep "callq" | grep "8-byte Folded Reload"
-
-%struct.targettype = type {i64}
-%struct.op_ptr1 = type opaque
-%struct.op_ptr2 = type opaque
-%union.anon = type { [8 x i32], [48 x i8] }
-%struct.const1 = type { [64 x i16], i8 }
-%struct.const2 = type { [17 x i8], [256 x i8], i8 }
-%struct.coef1 = type { %struct.ref1, i32, i32, i32, [10 x [64 x i16]*] }
-
-%struct.ref1 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, void (%struct.ref2*)*, i32 (%struct.ref2*, i8***)*, %struct.op_ptr2** }
-%struct.ref2 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32, %struct.localref11*, i32, i32, i32, i32, i32, i32, i32, double, i8, i8, i32, i8, i8, i8, i32, i8, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, i8**, i32, i32, i32, i32, i32, [64 x i32]*, [4 x %struct.const1*], [4 x %struct.const2*], [4 x %struct.const2*], i32, %struct.ref3*, i8, i8, [16 x i8], [16 x i8], [16 x i8], i32, i8, i8, i8, i8, i16, i16, i8, i8, i8, %struct.localref10*, i32, i32, i32, i32, i8*, i32, [4 x %struct.ref3*], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, %struct.localref8*, %struct.localref9*, %struct.ref1*, %struct.localref7*, %struct.localref6*, %struct.localref5*, %struct.localref1*, %struct.ref4*, %struct.localref2*, %struct.localref3*, %struct.localref4* }
-%struct.ref3 = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, %struct.const1*, i8* }
-%struct.ref4 = type { void (%struct.ref2*)*, [5 x void (%struct.ref2*, %struct.ref3*, i16*, i8**, i32)*] }
-
-%struct.localref1 = type { void (%struct.ref2*)*, i8 (%struct.ref2*, [64 x i16]**)*, i8 }
-%struct.localref2 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)*, i8 }
-%struct.localref3 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32, i8**, i32)* }
-%struct.localref4 = type { {}*, void (%struct.ref2*, i8**, i8**, i32)*, void (%struct.ref2*)*, void (%struct.ref2*)* }
-%struct.localref5 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, i8 (%struct.ref2*)*, i8, i8, i32, i32 }
-%struct.localref6 = type { i32 (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, i8, i8 }
-%struct.localref7 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)* }
-%struct.localref8 = type { void (%struct.ref2*)*, void (%struct.ref2*)*, i8 }
-%struct.localref9 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8**, i32*, i32)* }
-%struct.localref10 = type { %struct.localref10*, i8, i32, i32, i8* }
-%struct.localref11 = type { i8*, %struct.targettype, void (%struct.ref2*)*, i8 (%struct.ref2*)*, void (%struct.ref2*, %struct.targettype)*, i8 (%struct.ref2*, i32)*, void (%struct.ref2*)* }
-%struct.localref12 = type { {}*, %struct.targettype, %struct.targettype, i32, i32 }
-%struct.localref13 = type { void (%struct.localref14*)*, void (%struct.localref14*, i32)*, void (%struct.localref14*)*, void (%struct.localref14*, i8*)*, void (%struct.localref14*)*, i32, %union.anon, i32, %struct.targettype, i8**, i32, i8**, i32, i32 }
-%struct.localref14 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32 }
-%struct.localref15 = type { i8* (%struct.localref14*, i32, %struct.targettype)*, i8* (%struct.localref14*, i32, %struct.targettype)*, i8** (%struct.localref14*, i32, i32, i32)*, [64 x i16]** (%struct.localref14*, i32, i32, i32)*, %struct.op_ptr1* (%struct.localref14*, i32, i8, i32, i32, i32)*, %struct.op_ptr2* (%struct.localref14*, i32, i8, i32, i32, i32)*, {}*, i8** (%struct.localref14*, %struct.op_ptr1*, i32, i32, i8)*, [64 x i16]** (%struct.localref14*, %struct.op_ptr2*, i32, i32, i8)*, void (%struct.localref14*, i32)*, {}*, %struct.targettype, %struct.targettype}
-
-define internal i32 @foldedreload(%struct.ref2* %cinfo, i8*** nocapture %output1) {
- %1 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 79
- %2 = load %struct.ref1** %1, align 8
- %3 = bitcast %struct.ref1* %2 to %struct.coef1*
- %4 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 68
- %5 = load i32* %4, align 4
- %6 = add i32 %5, -1
- %7 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 64
- %8 = load i32* %7, align 4
- %9 = add i32 %8, -1
- %10 = getelementptr inbounds %struct.coef1* %3, i64 0, i32 2
- %11 = load i32* %10, align 4
- %12 = getelementptr inbounds %struct.ref1* %2, i64 1, i32 1
- %13 = bitcast i32 (%struct.ref2*)** %12 to i32*
- %14 = load i32* %13, align 4
- %15 = icmp slt i32 %11, %14
- br i1 %15, label %.lr.ph18, label %._crit_edge19
-
-.lr.ph18:
- %16 = getelementptr inbounds %struct.ref1* %2, i64 1
- %17 = bitcast %struct.ref1* %16 to i32*
- %18 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 66
- %19 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 84
- %20 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 36
- %21 = getelementptr inbounds %struct.ref1* %2, i64 1, i32 2
- %22 = bitcast void (%struct.ref2*)** %21 to [10 x [64 x i16]*]*
- %.pre = load i32* %17, align 4
- br label %23
-
-; <label>:23
- %24 = phi i32 [ %14, %.lr.ph18 ], [ %92, %91 ]
- %25 = phi i32 [ %.pre, %.lr.ph18 ], [ 0, %91 ]
- %var1.015 = phi i32 [ %11, %.lr.ph18 ], [ %93, %91 ]
- %26 = icmp ugt i32 %25, %6
- br i1 %26, label %91, label %.preheader7.lr.ph
-
-.preheader7.lr.ph:
- %.pre24 = load i32* %18, align 4
- br label %.preheader7
-
-.preheader7:
- %27 = phi i32 [ %.pre24, %.preheader7.lr.ph ], [ %88, %._crit_edge11 ]
- %var2.012 = phi i32 [ %25, %.preheader7.lr.ph ], [ %89, %._crit_edge11 ]
- %28 = icmp sgt i32 %27, 0
- br i1 %28, label %.lr.ph10, label %._crit_edge11
-
-.lr.ph10:
- %29 = phi i32 [ %27, %.preheader7 ], [ %85, %84 ]
- %indvars.iv21 = phi i64 [ 0, %.preheader7 ], [ %indvars.iv.next22, %84 ]
- %var4.09 = phi i32 [ 0, %.preheader7 ], [ %var4.1.lcssa, %84 ]
- %30 = getelementptr inbounds %struct.ref2* %cinfo, i64 0, i32 67, i64 %indvars.iv21
- %31 = load %struct.ref3** %30, align 8
- %32 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 1
- %33 = load i32* %32, align 4
- %34 = sext i32 %33 to i64
- %35 = load %struct.ref4** %19, align 8
- %36 = getelementptr inbounds %struct.ref4* %35, i64 0, i32 1, i64 %34
- %37 = load void (%struct.ref2*, %struct.ref3*, i16*, i8**, i32)** %36, align 8
- %38 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 17
- %39 = load i32* %38, align 4
- %40 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 9
- %41 = load i32* %40, align 4
- %42 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 16
- %43 = load i32* %42, align 4
- %44 = mul i32 %43, %var2.012
- %45 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 14
- %46 = load i32* %45, align 4
- %47 = icmp sgt i32 %46, 0
- br i1 %47, label %.lr.ph6, label %84
-
-.lr.ph6:
- %48 = mul nsw i32 %41, %var1.015
- %49 = getelementptr inbounds i8*** %output1, i64 %34
- %50 = sext i32 %48 to i64
- %51 = load i8*** %49, align 8
- %52 = getelementptr inbounds i8** %51, i64 %50
- %53 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 13
- %54 = getelementptr inbounds %struct.ref3* %31, i64 0, i32 18
- %55 = icmp sgt i32 %39, 0
- br i1 %55, label %.lr.ph6.split.us, label %.lr.ph6..lr.ph6.split_crit_edge
-
-.lr.ph6..lr.ph6.split_crit_edge:
- br label %._crit_edge28
-
-.lr.ph6.split.us:
- %56 = phi i32 [ %64, %._crit_edge30 ], [ %46, %.lr.ph6 ]
- %57 = phi i32 [ %65, %._crit_edge30 ], [ %41, %.lr.ph6 ]
- %var4.15.us = phi i32 [ %67, %._crit_edge30 ], [ %var4.09, %.lr.ph6 ]
- %output2.04.us = phi i8** [ %71, %._crit_edge30 ], [ %52, %.lr.ph6 ]
- %var5.03.us = phi i32 [ %68, %._crit_edge30 ], [ 0, %.lr.ph6 ]
- %58 = load i32* %20, align 4
- %59 = icmp ult i32 %58, %9
- br i1 %59, label %.lr.ph.us, label %60
-
-; <label>:60
- %61 = add nsw i32 %var5.03.us, %var1.015
- %62 = load i32* %54, align 4
- %63 = icmp slt i32 %61, %62
- br i1 %63, label %.lr.ph.us, label %._crit_edge29
-
-._crit_edge29:
- %64 = phi i32 [ %.pre25.pre, %.loopexit.us ], [ %56, %60 ]
- %65 = phi i32 [ %77, %.loopexit.us ], [ %57, %60 ]
- %66 = load i32* %53, align 4
- %67 = add nsw i32 %66, %var4.15.us
- %68 = add nsw i32 %var5.03.us, 1
- %69 = icmp slt i32 %68, %64
- br i1 %69, label %._crit_edge30, label %._crit_edge
-
-._crit_edge30:
- %70 = sext i32 %65 to i64
- %71 = getelementptr inbounds i8** %output2.04.us, i64 %70
- br label %.lr.ph6.split.us
-
-; <label>:72
- %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %72 ]
- %var3.02.us = phi i32 [ %44, %.lr.ph.us ], [ %78, %72 ]
- %73 = add nsw i64 %indvars.iv, %79
- %74 = getelementptr inbounds [10 x [64 x i16]*]* %22, i64 0, i64 %73
- %75 = load [64 x i16]** %74, align 8
- %76 = getelementptr inbounds [64 x i16]* %75, i64 0, i64 0
- tail call void %37(%struct.ref2* %cinfo, %struct.ref3* %31, i16* %76, i8** %output2.04.us, i32 %var3.02.us) nounwind
- %77 = load i32* %40, align 4
- %78 = add i32 %77, %var3.02.us
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %39
- br i1 %exitcond, label %.loopexit.us, label %72
-
-.loopexit.us:
- %.pre25.pre = load i32* %45, align 4
- br label %._crit_edge29
-
-.lr.ph.us:
- %79 = sext i32 %var4.15.us to i64
- br label %72
-
-._crit_edge28:
- %var4.15 = phi i32 [ %var4.09, %.lr.ph6..lr.ph6.split_crit_edge ], [ %81, %._crit_edge28 ]
- %var5.03 = phi i32 [ 0, %.lr.ph6..lr.ph6.split_crit_edge ], [ %82, %._crit_edge28 ]
- %80 = load i32* %53, align 4
- %81 = add nsw i32 %80, %var4.15
- %82 = add nsw i32 %var5.03, 1
- %83 = icmp slt i32 %82, %46
- br i1 %83, label %._crit_edge28, label %._crit_edge
-
-._crit_edge:
- %split = phi i32 [ %67, %._crit_edge29 ], [ %81, %._crit_edge28 ]
- %.pre27 = load i32* %18, align 4
- br label %84
-
-; <label>:84
- %85 = phi i32 [ %.pre27, %._crit_edge ], [ %29, %.lr.ph10 ]
- %var4.1.lcssa = phi i32 [ %split, %._crit_edge ], [ %var4.09, %.lr.ph10 ]
- %indvars.iv.next22 = add i64 %indvars.iv21, 1
- %86 = trunc i64 %indvars.iv.next22 to i32
- %87 = icmp slt i32 %86, %85
- br i1 %87, label %.lr.ph10, label %._crit_edge11
-
-._crit_edge11:
- %88 = phi i32 [ %27, %.preheader7 ], [ %85, %84 ]
- %89 = add i32 %var2.012, 1
- %90 = icmp ugt i32 %89, %6
- br i1 %90, label %._crit_edge14, label %.preheader7
-
-._crit_edge14:
- %.pre23 = load i32* %13, align 4
- br label %91
-
-; <label>:91
- %92 = phi i32 [ %.pre23, %._crit_edge14 ], [ %24, %23 ]
- store i32 0, i32* %17, align 4
- %93 = add nsw i32 %var1.015, 1
- %94 = icmp slt i32 %93, %92
- br i1 %94, label %23, label %._crit_edge19
-
-._crit_edge19:
- ret i32 3
+; RUN: grep "callq" | grep "*funcp"
+;
+; Original source code built with clang -S -emit-llvm -m64 test64.c:
+; int a, b, c, d, e, f, g, h, i, j, k, l, m, n;
+; extern int (*funcp)(int, int, int, int, int, int,
+; int, int, int, int, int, int,
+; int, int);
+; extern int sum;
+;
+; void func()
+; {
+; sum = 0;
+; for( i = a; i < b; ++i )
+; {
+; sum += (*funcp)(a, i, i*2, i/b, c, d, e, f, g, h, j, k, l, n);
+; }
+; }
+;
+; ModuleID = 'test64.c'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@sum = external global i32
+@a = common global i32 0, align 4
+@i = common global i32 0, align 4
+@b = common global i32 0, align 4
+@funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)*
+@c = common global i32 0, align 4
+@d = common global i32 0, align 4
+@e = common global i32 0, align 4
+@f = common global i32 0, align 4
+@g = common global i32 0, align 4
+@h = common global i32 0, align 4
+@j = common global i32 0, align 4
+@k = common global i32 0, align 4
+@l = common global i32 0, align 4
+@n = common global i32 0, align 4
+@m = common global i32 0, align 4
+
+define void @func() #0 {
+entry:
+ store i32 0, i32* @sum, align 4
+ %0 = load i32* @a, align 4
+ store i32 %0, i32* @i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %1 = load i32* @i, align 4
+ %2 = load i32* @b, align 4
+ %cmp = icmp slt i32 %1, %2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %3 = load i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)** @funcp, align 8
+ %4 = load i32* @a, align 4
+ %5 = load i32* @i, align 4
+ %6 = load i32* @i, align 4
+ %mul = mul nsw i32 %6, 2
+ %7 = load i32* @i, align 4
+ %8 = load i32* @b, align 4
+ %div = sdiv i32 %7, %8
+ %9 = load i32* @c, align 4
+ %10 = load i32* @d, align 4
+ %11 = load i32* @e, align 4
+ %12 = load i32* @f, align 4
+ %13 = load i32* @g, align 4
+ %14 = load i32* @h, align 4
+ %15 = load i32* @j, align 4
+ %16 = load i32* @k, align 4
+ %17 = load i32* @l, align 4
+ %18 = load i32* @n, align 4
+ %call = call i32 %3(i32 %4, i32 %5, i32 %mul, i32 %div, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18)
+ %19 = load i32* @sum, align 4
+ %add = add nsw i32 %19, %call
+ store i32 %add, i32* @sum, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %20 = load i32* @i, align 4
+ %inc = add nsw i32 %20, 1
+ store i32 %inc, i32* @i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }