summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-04-15 20:45:00 +0000
committerCameron Zwarich <zwarich@apple.com>2011-04-15 20:45:00 +0000
commit0829b3065ad3144e6bf489bc9b3ff68eb1a0c65a (patch)
tree4d04ebece93ba3787281ca6bb6f26dd4880468cc /llvm/test/CodeGen
parent7583dbdc8852e376feccf27b40db2805ad1ad693 (diff)
downloadbcm5719-llvm-0829b3065ad3144e6bf489bc9b3ff68eb1a0c65a.tar.gz
bcm5719-llvm-0829b3065ad3144e6bf489bc9b3ff68eb1a0c65a.zip
The AND instruction leaves the V flag unmodified, so it falls victim to the same
problem as all of the other instructions we fold with CMPs. llvm-svn: 129602
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/ARM/2011-04-15-AndVFlagPeepholeBug.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/2011-04-15-AndVFlagPeepholeBug.ll b/llvm/test/CodeGen/ARM/2011-04-15-AndVFlagPeepholeBug.ll
new file mode 100644
index 00000000000..e712e08ddb6
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/2011-04-15-AndVFlagPeepholeBug.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 | FileCheck %s
+
+; CHECK: _f
+; CHECK-NOT: ands
+; CHECK: cmp
+; CHECK: blxle _g
+
+define i32 @f(i32 %a, i32 %b) nounwind ssp {
+entry:
+ %and = and i32 %b, %a
+ %cmp = icmp slt i32 %and, 1
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ tail call void (...)* @g(i32 %a, i32 %b) nounwind
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret i32 %and
+}
+
+declare void @g(...)
OpenPOWER on IntegriCloud