aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2020-09-14 12:08:34 +0100
committerDavid Green <david.green@arm.com>2020-09-14 12:08:34 +0100
commit06fb4e90649f264a129d3ad2a08fd3492ee78651 (patch)
tree1374955ca3d3f0c306770539648d9c0eb7c1188b /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentf715d81c9df3fb3e047a54899fc749f57c84aeb5 (diff)
downloadllvm-06fb4e90649f264a129d3ad2a08fd3492ee78651.zip
llvm-06fb4e90649f264a129d3ad2a08fd3492ee78651.tar.gz
llvm-06fb4e90649f264a129d3ad2a08fd3492ee78651.tar.bz2
[CGP] Limit converting phi types to simple loads and stores
Instcombine limits converting phi types to simple loads and stores. This does the same in codegenprepare, not processing phis that are not simple. Note that volatile loads/store ISel will happily convert between float and int. Atomics are more likely to always be integer. This just keeps things simple and doesn't process either. Differential Revision: https://reviews.llvm.org/D83770
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index bb0bad7..45feeae 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5831,6 +5831,8 @@ bool CodeGenPrepare::optimizePhiType(
Worklist.push_back(OpPhi);
}
} else if (auto *OpLoad = dyn_cast<LoadInst>(V)) {
+ if (!OpLoad->isSimple())
+ return false;
if (!Defs.count(OpLoad)) {
Defs.insert(OpLoad);
Worklist.push_back(OpLoad);
@@ -5868,7 +5870,7 @@ bool CodeGenPrepare::optimizePhiType(
Worklist.push_back(OpPhi);
}
} else if (auto *OpStore = dyn_cast<StoreInst>(V)) {
- if (OpStore->getOperand(0) != II)
+ if (!OpStore->isSimple() || OpStore->getOperand(0) != II)
return false;
Uses.insert(OpStore);
} else if (auto *OpBC = dyn_cast<BitCastInst>(V)) {