Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Commit 307be8a

Browse files
committed
Apply an InstCombine backport via rust-lang/llvm#51
1 parent 262978a commit 307be8a

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

0001-Backport-rL281650.patch

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 7801978ec1f3637fcda1b564048ebc732bf586af Mon Sep 17 00:00:00 2001
2+
From: Simonas Kazlauskas <[email protected]>
3+
Date: Fri, 16 Sep 2016 00:32:20 +0300
4+
Subject: [PATCH] Backport rL281650
5+
6+
---
7+
lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 +-
8+
test/Transforms/InstCombine/indexed-gep-compares.ll | 20 ++++++++++++++++++++
9+
2 files changed, 21 insertions(+), 1 deletion(-)
10+
11+
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
12+
index bfd73f4bbac5..961497fe3c2d 100644
13+
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
14+
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
15+
@@ -634,7 +634,7 @@ static bool canRewriteGEPAsOffset(Value *Start, Value *Base,
16+
}
17+
18+
if (!isa<IntToPtrInst>(V) && !isa<PtrToIntInst>(V) &&
19+
- !isa<GEPOperator>(V) && !isa<PHINode>(V))
20+
+ !isa<GetElementPtrInst>(V) && !isa<PHINode>(V))
21+
// We've found some value that we can't explore which is different from
22+
// the base. Therefore we can't do this transformation.
23+
return false;
24+
diff --git a/test/Transforms/InstCombine/indexed-gep-compares.ll b/test/Transforms/InstCombine/indexed-gep-compares.ll
25+
index 495881549e25..64dff2712976 100644
26+
--- a/test/Transforms/InstCombine/indexed-gep-compares.ll
27+
+++ b/test/Transforms/InstCombine/indexed-gep-compares.ll
28+
@@ -167,4 +167,24 @@ lpad:
29+
; CHECK: ret i32* %[[PTR]]
30+
}
31+
32+
+
33+
+@pr30402 = constant i64 3
34+
+define i1 @test7() {
35+
+entry:
36+
+ br label %bb7
37+
+
38+
+bb7: ; preds = %bb10, %entry-block
39+
+ %phi = phi i64* [ @pr30402, %entry ], [ getelementptr inbounds (i64, i64* @pr30402, i32 1), %bb7 ]
40+
+ %cmp = icmp eq i64* %phi, getelementptr inbounds (i64, i64* @pr30402, i32 1)
41+
+ br i1 %cmp, label %bb10, label %bb7
42+
+
43+
+bb10:
44+
+ ret i1 %cmp
45+
+}
46+
+; CHECK-LABEL: @test7(
47+
+; CHECK: %[[phi:.*]] = phi i64* [ @pr30402, %entry ], [ getelementptr inbounds (i64, i64* @pr30402, i32 1), %bb7 ]
48+
+; CHECK: %[[cmp:.*]] = icmp eq i64* %[[phi]], getelementptr inbounds (i64, i64* @pr30402, i32 1)
49+
+; CHECK: ret i1 %[[cmp]]
50+
+
51+
+
52+
declare i32 @__gxx_personality_v0(...)
53+
--
54+
2.7.4
55+

llvm.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Name: llvm
99
Version: 3.9.0
10-
Release: 1%{?dist}
10+
Release: 2%{?dist}
1111
Summary: The Low Level Virtual Machine
1212

1313
License: NCSA
@@ -23,6 +23,7 @@ Patch1: 0001-This-code-block-breaks-the-docs-build-http-lab.llvm..patch
2323
Patch2: 0001-fix-docs-2.patch
2424
Patch3: 0001-fix-docs-3.patch
2525
Patch4: 0001-docs-fix-cmake-code-block-warning.patch
26+
Patch5: 0001-Backport-rL281650.patch
2627

2728
BuildRequires: cmake
2829
BuildRequires: zlib-devel
@@ -79,6 +80,7 @@ Static libraries for the LLVM compiler infrastructure.
7980
%patch2 -p1 -b .docs2
8081
%patch3 -p1 -b .docs3
8182
%patch4 -p1 -b .docs4
83+
%patch5 -p1 -b .rust1
8284

8385
%build
8486
mkdir -p _build
@@ -194,6 +196,9 @@ make check-all || :
194196
%{_libdir}/*.a
195197

196198
%changelog
199+
* Sat Oct 15 2016 Josh Stone <[email protected]> - 3.9.0-2
200+
- Apply an InstCombine backport via rust-lang/llvm#51
201+
197202
* Wed Sep 07 2016 Dave Airlie <[email protected]> - 3.9.0-1
198203
- llvm 3.9.0
199204
- upstream moved where cmake files are packaged.

0 commit comments

Comments
 (0)