[PATCH] D123454: Some small performance enhancments to InstCombineLoadStoreAlloca.cpp
Dale Martin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 9 06:27:26 PDT 2022
DaleEMartin created this revision.
Herald added subscribers: luke957, s.egerton, simoncook, hiraditya, dschuff.
Herald added a project: All.
DaleEMartin requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, aheejin.
Herald added a project: LLVM.
I noticed a couple of small opportunities to bail earlier if we're going to bail.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123454
Files:
.gitignore
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -54,6 +54,9 @@
for (auto &U : ValuePair.first->uses()) {
auto *I = cast<Instruction>(U.getUser());
+ // If we already have seen aƒZThe copy, reject the second one.
+ if (TheCopy) return false;
+
if (auto *LI = dyn_cast<LoadInst>(I)) {
// Ignore non-volatile loads, they are always ok.
if (!LI->isSimple()) return false;
@@ -72,6 +75,10 @@
continue;
}
+ // If the pointer has been offset from the start of the alloca, we can't
+ // safely handle this.
+ if (IsOffset) return false;
+
if (auto *Call = dyn_cast<CallBase>(I)) {
// If this is the function being called then we treat it like a load and
// ignore it.
@@ -118,13 +125,6 @@
continue;
}
- // If we already have seen a copy, reject the second one.
- if (TheCopy) return false;
-
- // If the pointer has been offset from the start of the alloca, we can't
- // safely handle this.
- if (IsOffset) return false;
-
// If the memintrinsic isn't using the alloca as the dest, reject it.
if (U.getOperandNo() != 0) return false;
Index: .gitignore
===================================================================
--- .gitignore
+++ .gitignore
@@ -68,3 +68,42 @@
/clang/utils/analyzer/projects/*/RefScanBuildResults
# automodapi puts generated documentation files here.
/lldb/docs/python_api/
+*.xcbuild
+*.a
+*.o
+*.dia
+*.d
+*.dat
+llvm/xcode/build/XCBuildData/*
+llvm/xcode/include/llvm/IR/LLVM.build/Debug/intrinsics_gen.build/Script-00566DF9EE997D9D0A1E1319.sh
+*.pbxproj
+*.LinkFileList
+*.sh
+*.pbxproj
+*.plist
+*.xcsettings
+llvm/xcode/LLVM.xcodeproj/project.xcworkspace/xcuserdata/dalemartin.xcuserdatad/UserInterfaceState.xcuserstate
+llvm/xcode/LLVM.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+llvm/xcode/LLVM.xcodeproj/project.pbxproj
+llvm/xcode/include/llvm/Support/VCSRevision.h
+llvm/xcode/include/llvm/IR/IntrinsicsXCore.h
+llvm/xcode/include/llvm/IR/IntrinsicsX86.h
+llvm/xcode/include/llvm/IR/IntrinsicsWebAssembly.h
+llvm/xcode/include/llvm/IR/IntrinsicsVE.h
+llvm/xcode/include/llvm/IR/IntrinsicsS390.h
+llvm/xcode/include/llvm/IR/IntrinsicsRISCV.h
+llvm/xcode/include/llvm/IR/IntrinsicsR600.h
+llvm/xcode/include/llvm/IR/IntrinsicsPowerPC.h
+llvm/xcode/include/llvm/IR/IntrinsicsNVPTX.h
+llvm/xcode/include/llvm/IR/IntrinsicsMips.h
+llvm/xcode/include/llvm/IR/IntrinsicsHexagon.h
+llvm/xcode/include/llvm/IR/IntrinsicsBPF.h
+llvm/xcode/include/llvm/IR/IntrinsicsARM.h
+llvm/xcode/include/llvm/IR/IntrinsicsAMDGPU.h
+llvm/xcode/include/llvm/IR/IntrinsicsAArch64.h
+llvm/xcode/include/llvm/IR/IntrinsicImpl.inc
+llvm/xcode/include/llvm/IR/IntrinsicEnums.inc
+llvm/xcode/include/llvm/IR/Attributes.inc
+llvm/xcode/Debug/bin/verify-uselistorder
+llvm/xcode/Debug/bin/llvm-tblgen
+llvm/xcode/LLVM.xcodeproj/.*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123454.421725.patch
Type: text/x-patch
Size: 3153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220409/8b37c871/attachment.bin>
More information about the llvm-commits
mailing list