aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorPaulo Matos <pmatos@igalia.com>2021-07-22 21:11:39 +0200
committerPaulo Matos <pmatos@igalia.com>2021-07-22 22:07:24 +0200
commit46667a10039b664b953eb70534c27627b35a267d (patch)
treed8de1c786f43b6a20ed295c55645d12987bb5358 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentdf0066a1c9b9610c58d336bdf353e20a20b7ab3f (diff)
downloadllvm-46667a10039b664b953eb70534c27627b35a267d.zip
llvm-46667a10039b664b953eb70534c27627b35a267d.tar.gz
llvm-46667a10039b664b953eb70534c27627b35a267d.tar.bz2
[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Reland of 31859f896. 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/D104797
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 163236c..1c0932e 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6465,6 +6465,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);