[PATCH] D111098: [LICM] Bail if checking a global/constant for invariant.start
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 4 14:00:41 PDT 2021
aeubanks updated this revision to Diff 377030.
aeubanks added a comment.
update test comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111098/new/
https://reviews.llvm.org/D111098
Files:
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/hoisting.ll
Index: llvm/test/Transforms/LICM/hoisting.ll
===================================================================
--- llvm/test/Transforms/LICM/hoisting.ll
+++ llvm/test/Transforms/LICM/hoisting.ll
@@ -602,16 +602,16 @@
@a = external global i8
-; FIXME: Don't hoist invariant loads of globals.
+; FIXME: Support hoisting invariant loads of globals.
define void @test_fence6() {
; CHECK-LABEL: @test_fence6(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[I:%.*]] = call {}* @llvm.invariant.start.p0i8(i64 1, i8* @a)
+; CHECK-NEXT: br label [[F:%.*]]
+; CHECK: f:
; CHECK-NEXT: [[TMP0:%.*]] = load i8, i8* @a, align 1
; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[TMP0]], 0
; CHECK-NEXT: [[T:%.*]] = icmp eq i8 [[TMP1]], 0
-; CHECK-NEXT: br label [[F:%.*]]
-; CHECK: f:
; CHECK-NEXT: tail call void @g(i1 [[T]])
; CHECK-NEXT: br label [[F]]
;
Index: llvm/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LICM.cpp
+++ llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1068,6 +1068,10 @@
return false;
Addr = BC->getOperand(0);
}
+ // If we've ended up at a global/constant, bail. We shouldn't be looking at
+ // uselists for non-local Values in a loop pass.
+ if (isa<Constant>(Addr))
+ return false;
unsigned UsesVisited = 0;
// Traverse all uses of the load operand value, to see if invariant.start is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111098.377030.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/aae0c0ed/attachment.bin>
More information about the llvm-commits
mailing list