From 0444ffab64aab77d74252b9c08445cd46b595d84 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 6 Mar 2014 12:50:19 -0800 Subject: handle aliases in getConstAsOffset --- lib/Target/JSBackend/JSBackend.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 856a051fe9..ec33d4cd83 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -313,6 +313,9 @@ namespace { // Return a constant we are about to write into a global as a numeric offset. If the // value is not known at compile time, emit a postSet to that location. unsigned getConstAsOffset(const Value *V, unsigned AbsoluteTarget) { + if (const GlobalAlias *GA = dyn_cast(V)) { + V = GA->getAliasee(); + } if (const Function *F = dyn_cast(V)) { return getFunctionIndex(F); } else if (const BlockAddress *BA = dyn_cast(V)) { -- cgit v1.2.3-18-g5258