aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorPaulo Matos <pmatos@igalia.com>2021-06-10 10:02:10 +0200
committerPaulo Matos <pmatos@igalia.com>2021-06-10 10:07:45 +0200
commit31859f896cf90d64904134ce7b31230f374c3fcc (patch)
tree82be96496afd3d6408de39b8a53f6cf5f0aeb7cc /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentad6a84f82c4572dd92369b4f67df6e7c3536f9a2 (diff)
downloadllvm-31859f896cf90d64904134ce7b31230f374c3fcc.zip
llvm-31859f896cf90d64904134ce7b31230f374c3fcc.tar.gz
llvm-31859f896cf90d64904134ce7b31230f374c3fcc.tar.bz2
Implementation of global.get/set for reftypes in LLVM IR
This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and lowering methods for load and stores of reference types from IR globals. Once the lowering creates the new nodes, tablegen pattern matches those and converts them to Wasm global.get/set. Reviewed By: tlively Differential Revision: https://reviews.llvm.org/D95425
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 0bdaaa6..4570072 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6451,6 +6451,10 @@ bool CodeGenPrepare::optimizeLoadExt(LoadInst *Load) {
EVT LoadResultVT = TLI->getValueType(*DL, Load->getType());
unsigned BitWidth = LoadResultVT.getSizeInBits();
+ // If the BitWidth is 0, do not try to optimize the type
+ if (BitWidth == 0)
+ return false;
+
APInt DemandBits(BitWidth, 0);
APInt WidestAndBits(BitWidth, 0);