[PATCH] D138585: [SLPVectorizer] Do Not Move Loads/Stores Beyond Stacksave/Stackrestore Boundaries
Qiongsi Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 14:53:50 PST 2022
qiongsiwu1 updated this revision to Diff 477618.
qiongsiwu1 added a comment.
Updating code comment.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138585/new/
https://reviews.llvm.org/D138585
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/stackrestore-dependence.ll
Index: llvm/test/Transforms/SLPVectorizer/X86/stackrestore-dependence.ll
===================================================================
--- llvm/test/Transforms/SLPVectorizer/X86/stackrestore-dependence.ll
+++ llvm/test/Transforms/SLPVectorizer/X86/stackrestore-dependence.ll
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=slp-vectorizer -slp-threshold=-999 -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake -S < %s | FileCheck %s
-; The tests checks that loads should not be moved below a stackrestore boundary.
+; The test checks that loads should not be moved below a stackrestore boundary.
define void @stackrestore1(ptr %out) {
; CHECK-LABEL: @stackrestore1(
; CHECK-NEXT: [[STACK:%.*]] = call ptr @llvm.stacksave()
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -10042,8 +10042,10 @@
}
// In addition to the cases handle just above, we need to prevent
- // allocas and loads/stores from moving below a stacksave. The
- // stackrestore case is currently thought to be conservatism.
+ // allocas and loads/stores from moving below a stacksave or a
+ // stackrestore. Avoiding moving allocas below stackrestore is currently
+ // thought to be conservatism. Moving loads/stores below a stackrestore
+ // can lead to incorrect code.
if (isa<AllocaInst>(BundleMember->Inst) ||
BundleMember->Inst->mayReadOrWriteMemory()) {
for (Instruction *I = BundleMember->Inst->getNextNode();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138585.477618.patch
Type: text/x-patch
Size: 1734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221123/49e5e9e8/attachment.bin>
More information about the llvm-commits
mailing list