Skip to content

Commit df6887b

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:2e3d3903e624 into amd-gfx:bc2da11325e0
Local branch amd-gfx bc2da11 Merged main:f590963db836 into amd-gfx:23e4c3a6e3aa Remote branch main 2e3d390 [polly] Skip instructions of different function in isHoistableLoad. (llvm#118963)
2 parents bc2da11 + 2e3d390 commit df6887b

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 522534
19+
#define LLVM_MAIN_REVISION 522535
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

polly/lib/Support/ScopHelper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ bool polly::isHoistableLoad(LoadInst *LInst, Region &R, LoopInfo &LI,
604604

605605
for (auto *User : Ptr->users()) {
606606
auto *UserI = dyn_cast<Instruction>(User);
607-
if (!UserI || !R.contains(UserI))
607+
if (!UserI || UserI->getFunction() != LInst->getFunction() ||
608+
!R.contains(UserI))
608609
continue;
609610
if (!UserI->mayWriteToMemory())
610611
continue;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; RUN: opt %loadNPMPolly '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s
2+
3+
; CHECK: Detected Scops in Function foo
4+
5+
; This unit test case is to check if the following IR does not crash in isHoistableLoad function during Scop Detection.
6+
7+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
8+
target triple = "aarch64-unknown-linux-gnueabi"
9+
10+
define void @foo(ptr %block) {
11+
entry:
12+
br label %for.body
13+
14+
for.cond1.preheader: ; preds = %for.body
15+
%0 = load ptr, ptr null, align 8
16+
%1 = load i16, ptr %block, align 2
17+
%2 = load i16, ptr %0, align 2
18+
br label %foo.exit
19+
20+
for.body: ; preds = %for.body, %entry
21+
br i1 false, label %for.cond1.preheader, label %for.body
22+
23+
foo.exit: ; preds = %for.cond1.preheader
24+
ret void
25+
}
26+
27+
define void @init_foo() {
28+
entry:
29+
store ptr null, ptr null, align 8
30+
ret void
31+
}

0 commit comments

Comments
 (0)