summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-08-22 11:02:37 +0000
committerRenato Golin <renato.golin@linaro.org>2017-08-22 11:02:37 +0000
commitf63d701669ebb6c40f2b4b23a1c4061daed2d500 (patch)
tree110e4724af73b79f801e558645b96a247acb67eb
parentaa603c3bef06a5779619d2e3138c46e3037f0d67 (diff)
downloadbcm5719-llvm-f63d701669ebb6c40f2b4b23a1c4061daed2d500.tar.gz
bcm5719-llvm-f63d701669ebb6c40f2b4b23a1c4061daed2d500.zip
[ARM] Call setBooleanContents(ZeroOrOneBooleanContent)
The ARM backend should call setBooleanContents so that it can use known bits to make some optimizations. Review: D35821 Patch by Joel Galenson <jgalenson@google.com> llvm-svn: 311446
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp1
-rw-r--r--llvm/test/CodeGen/ARM/cse-call.ll9
-rw-r--r--llvm/test/CodeGen/ARM/i1.ll15
-rw-r--r--llvm/test/CodeGen/ARM/sub-cmp-peephole.ll6
-rw-r--r--llvm/test/CodeGen/ARM/wide-compares.ll6
-rw-r--r--llvm/test/CodeGen/Thumb2/2009-09-28-ITBlockBug.ll152
-rw-r--r--llvm/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll2
7 files changed, 30 insertions, 161 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 0d4d847ef10..03d0b7e2a74 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -221,6 +221,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
RegInfo = Subtarget->getRegisterInfo();
Itins = Subtarget->getInstrItineraryData();
+ setBooleanContents(ZeroOrOneBooleanContent);
setBooleanVectorContents(ZeroOrNegativeOneBooleanContent);
if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetIOS() &&
diff --git a/llvm/test/CodeGen/ARM/cse-call.ll b/llvm/test/CodeGen/ARM/cse-call.ll
index 4e61a3495b8..f0175cbef4a 100644
--- a/llvm/test/CodeGen/ARM/cse-call.ll
+++ b/llvm/test/CodeGen/ARM/cse-call.ll
@@ -15,16 +15,17 @@ target triple = "armv6-apple-ios0.0.0"
declare i32 @strlen(i8* nocapture) nounwind readonly
declare void @S_trimzeros(...)
-define i8* @F_floatmul(i8* %f1, i8* %f2) nounwind ssp {
+define i8* @F_floatmul(i8* %f1, i8* %f2, i32 %a, i32 %b) nounwind ssp {
entry:
- br i1 undef, label %while.end42, label %while.body37
+ %0 = icmp eq i32 %a, %b
+ br i1 %0, label %while.end42, label %while.body37
while.body37: ; preds = %while.body37, %entry
br i1 false, label %while.end42, label %while.body37
while.end42: ; preds = %while.body37, %entry
- %. = select i1 undef, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man1, i32 0, i32 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man2, i32 0, i32 0)
- %.92 = select i1 undef, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man2, i32 0, i32 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man1, i32 0, i32 0)
+ %. = select i1 %0, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man1, i32 0, i32 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man2, i32 0, i32 0)
+ %.92 = select i1 %0, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man2, i32 0, i32 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @F_floatmul.man1, i32 0, i32 0)
tail call void bitcast (void (...)* @S_trimzeros to void (i8*)*)(i8* %.92) nounwind
%call47 = tail call i32 @strlen(i8* %.) nounwind
unreachable
diff --git a/llvm/test/CodeGen/ARM/i1.ll b/llvm/test/CodeGen/ARM/i1.ll
new file mode 100644
index 00000000000..379cca192a2
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/i1.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s
+
+define i32 @test1() {
+; CHECK-LABEL: test1:
+; CHECK: mov r0, #0
+; CHECK-NEXT: cmp r0, #0
+entry:
+ br i1 undef, label %t, label %f
+
+t:
+ ret i32 4
+
+f:
+ ret i32 2
+}
diff --git a/llvm/test/CodeGen/ARM/sub-cmp-peephole.ll b/llvm/test/CodeGen/ARM/sub-cmp-peephole.ll
index 32038883469..80a4272ec0a 100644
--- a/llvm/test/CodeGen/ARM/sub-cmp-peephole.ll
+++ b/llvm/test/CodeGen/ARM/sub-cmp-peephole.ll
@@ -73,11 +73,11 @@ if.else:
; CHECK: bc_raise
; CHECK: rsbeq
; CHECK: cmp
-define i32 @bc_raise() nounwind ssp {
+define i32 @bc_raise(i1 %cond) nounwind ssp {
entry:
- %val.2.i = select i1 undef, i32 0, i32 undef
+ %val.2.i = select i1 %cond, i32 0, i32 undef
%sub.i = sub nsw i32 0, %val.2.i
- %retval.0.i = select i1 undef, i32 %val.2.i, i32 %sub.i
+ %retval.0.i = select i1 %cond, i32 %val.2.i, i32 %sub.i
%cmp1 = icmp eq i32 %retval.0.i, 0
br i1 %cmp1, label %land.lhs.true, label %if.end11
diff --git a/llvm/test/CodeGen/ARM/wide-compares.ll b/llvm/test/CodeGen/ARM/wide-compares.ll
index 08e07ef76ad..8a3332211cb 100644
--- a/llvm/test/CodeGen/ARM/wide-compares.ll
+++ b/llvm/test/CodeGen/ARM/wide-compares.ll
@@ -36,7 +36,11 @@ entry:
; CHECK-ARM: sbcs {{[^,]+}}, r1, r3
; CHECK-THUMB2: subs {{[^,]+}}, r0, r2
; CHECK-THUMB2: sbcs.w {{[^,]+}}, r1, r3
- ; CHECK: bge [[BB2:\.[0-9A-Za-z_]+]]
+ ; CHECK-ARM: movwge r12, #1
+ ; CHECK-ARM: cmp r12, #0
+ ; CHECK-THUMB2: movge.w r12, #1
+ ; CHECK-THUMB: cmp.w r12, #0
+ ; CHECK: bne [[BB2:\.[0-9A-Za-z_]+]]
br i1 %cmp, label %bb1, label %bb2
bb1:
call void @f()
diff --git a/llvm/test/CodeGen/Thumb2/2009-09-28-ITBlockBug.ll b/llvm/test/CodeGen/Thumb2/2009-09-28-ITBlockBug.ll
deleted file mode 100644
index 8fdff02f9c1..00000000000
--- a/llvm/test/CodeGen/Thumb2/2009-09-28-ITBlockBug.ll
+++ /dev/null
@@ -1,152 +0,0 @@
-; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-cgp-branch-opts -arm-atomic-cfg-tidy=0 | FileCheck %s
-
-%struct.pix_pos = type { i32, i32, i32, i32, i32, i32 }
-
-@getNeighbour = external global void (i32, i32, i32, i32, %struct.pix_pos*)*, align 4 ; <void (i32, i32, i32, i32, %struct.pix_pos*)**> [#uses=2]
-
-define void @t() nounwind {
-; CHECK-LABEL: t:
-; CHECK: it eq
-; CHECK-NEXT: cmpeq
-entry:
- %pix_a.i294 = alloca [4 x %struct.pix_pos], align 4 ; <[4 x %struct.pix_pos]*> [#uses=2]
- br i1 undef, label %land.rhs, label %lor.end
-
-land.rhs: ; preds = %entry
- br label %lor.end
-
-lor.end: ; preds = %land.rhs, %entry
- switch i32 0, label %if.end371 [
- i32 10, label %if.then366
- i32 14, label %if.then366
- ]
-
-if.then366: ; preds = %lor.end, %lor.end
- unreachable
-
-if.end371: ; preds = %lor.end
- %arrayidx56.2.i = getelementptr [4 x %struct.pix_pos], [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 2 ; <%struct.pix_pos*> [#uses=1]
- %arrayidx56.3.i = getelementptr [4 x %struct.pix_pos], [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 3 ; <%struct.pix_pos*> [#uses=1]
- br i1 undef, label %for.body1857, label %for.end4557
-
-for.body1857: ; preds = %if.end371
- br i1 undef, label %if.then1867, label %for.cond1933
-
-if.then1867: ; preds = %for.body1857
- unreachable
-
-for.cond1933: ; preds = %for.body1857
- br i1 undef, label %for.body1940, label %if.then4493
-
-for.body1940: ; preds = %for.cond1933
- %shl = shl i32 undef, 2 ; <i32> [#uses=1]
- %shl1959 = shl i32 undef, 2 ; <i32> [#uses=4]
- br i1 undef, label %if.then1992, label %if.else2003
-
-if.then1992: ; preds = %for.body1940
- %tmp14.i302 = load i32, i32* undef ; <i32> [#uses=4]
- %add.i307452 = or i32 %shl1959, 1 ; <i32> [#uses=1]
- %sub.i308 = add i32 %shl, -1 ; <i32> [#uses=4]
- call void undef(i32 %tmp14.i302, i32 %sub.i308, i32 %shl1959, i32 0, %struct.pix_pos* undef) nounwind
- %tmp49.i309 = load void (i32, i32, i32, i32, %struct.pix_pos*)*, void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
- call void %tmp49.i309(i32 %tmp14.i302, i32 %sub.i308, i32 %add.i307452, i32 0, %struct.pix_pos* null) nounwind
- %tmp49.1.i = load void (i32, i32, i32, i32, %struct.pix_pos*)*, void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
- call void %tmp49.1.i(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.2.i) nounwind
- call void undef(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.3.i) nounwind
- unreachable
-
-if.else2003: ; preds = %for.body1940
- switch i32 undef, label %if.then2015 [
- i32 10, label %if.then4382
- i32 14, label %if.then4382
- ]
-
-if.then2015: ; preds = %if.else2003
- br i1 undef, label %if.else2298, label %if.then2019
-
-if.then2019: ; preds = %if.then2015
- br i1 undef, label %if.then2065, label %if.else2081
-
-if.then2065: ; preds = %if.then2019
- br label %if.end2128
-
-if.else2081: ; preds = %if.then2019
- br label %if.end2128
-
-if.end2128: ; preds = %if.else2081, %if.then2065
- unreachable
-
-if.else2298: ; preds = %if.then2015
- br i1 undef, label %land.lhs.true2813, label %cond.end2841
-
-land.lhs.true2813: ; preds = %if.else2298
- br i1 undef, label %cond.end2841, label %cond.true2824
-
-cond.true2824: ; preds = %land.lhs.true2813
- br label %cond.end2841
-
-cond.end2841: ; preds = %cond.true2824, %land.lhs.true2813, %if.else2298
- br i1 undef, label %for.cond2882.preheader, label %for.cond2940.preheader
-
-for.cond2882.preheader: ; preds = %cond.end2841
- %mul3693 = shl i32 undef, 1 ; <i32> [#uses=2]
- br i1 undef, label %if.then3689, label %if.else3728
-
-for.cond2940.preheader: ; preds = %cond.end2841
- br label %for.inc3040
-
-for.inc3040: ; preds = %for.inc3040, %for.cond2940.preheader
- br label %for.inc3040
-
-if.then3689: ; preds = %for.cond2882.preheader
- %add3695 = add nsw i32 %mul3693, %shl1959 ; <i32> [#uses=1]
- %mul3697 = shl i32 %add3695, 2 ; <i32> [#uses=2]
- %arrayidx3705 = getelementptr inbounds i16, i16* undef, i32 1 ; <i16*> [#uses=1]
- %tmp3706 = load i16, i16* %arrayidx3705 ; <i16> [#uses=1]
- %conv3707 = sext i16 %tmp3706 to i32 ; <i32> [#uses=1]
- %add3708 = add nsw i32 %conv3707, %mul3697 ; <i32> [#uses=1]
- %arrayidx3724 = getelementptr inbounds i16, i16* null, i32 1 ; <i16*> [#uses=1]
- %tmp3725 = load i16, i16* %arrayidx3724 ; <i16> [#uses=1]
- %conv3726 = sext i16 %tmp3725 to i32 ; <i32> [#uses=1]
- %add3727 = add nsw i32 %conv3726, %mul3697 ; <i32> [#uses=1]
- br label %if.end3770
-
-if.else3728: ; preds = %for.cond2882.preheader
- %mul3733 = add i32 %shl1959, 1073741816 ; <i32> [#uses=1]
- %add3735 = add nsw i32 %mul3733, %mul3693 ; <i32> [#uses=1]
- %mul3737 = shl i32 %add3735, 2 ; <i32> [#uses=2]
- %tmp3746 = load i16, i16* undef ; <i16> [#uses=1]
- %conv3747 = sext i16 %tmp3746 to i32 ; <i32> [#uses=1]
- %add3748 = add nsw i32 %conv3747, %mul3737 ; <i32> [#uses=1]
- %arrayidx3765 = getelementptr inbounds i16, i16* null, i32 1 ; <i16*> [#uses=1]
- %tmp3766 = load i16, i16* %arrayidx3765 ; <i16> [#uses=1]
- %conv3767 = sext i16 %tmp3766 to i32 ; <i32> [#uses=1]
- %add3768 = add nsw i32 %conv3767, %mul3737 ; <i32> [#uses=1]
- br label %if.end3770
-
-if.end3770: ; preds = %if.else3728, %if.then3689
- %vec2_y.1 = phi i32 [ %add3727, %if.then3689 ], [ %add3768, %if.else3728 ] ; <i32> [#uses=0]
- %vec1_y.2 = phi i32 [ %add3708, %if.then3689 ], [ %add3748, %if.else3728 ] ; <i32> [#uses=0]
- unreachable
-
-if.then4382: ; preds = %if.else2003, %if.else2003
- switch i32 undef, label %if.then4394 [
- i32 10, label %if.else4400
- i32 14, label %if.else4400
- ]
-
-if.then4394: ; preds = %if.then4382
- unreachable
-
-if.else4400: ; preds = %if.then4382, %if.then4382
- br label %for.cond4451.preheader
-
-for.cond4451.preheader: ; preds = %for.cond4451.preheader, %if.else4400
- br label %for.cond4451.preheader
-
-if.then4493: ; preds = %for.cond1933
- unreachable
-
-for.end4557: ; preds = %if.end371
- ret void
-}
diff --git a/llvm/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll b/llvm/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll
index 382f5dc281d..d0afa3c8dfe 100644
--- a/llvm/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll
+++ b/llvm/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll
@@ -8,7 +8,7 @@ declare void @bar() nounwind optsize
define void @foo() nounwind optsize "no-frame-pointer-elim"="true" {
; CHECK-LABEL: foo:
; CHECK: push
-; CHECK: mov r7, sp
+; CHECK: add r7, sp
; CHECK: sub sp, #4
entry:
%m.i = alloca %struct.buf*, align 4
OpenPOWER on IntegriCloud