diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-06 12:50:19 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-06 12:50:19 -0800 |
commit | 0444ffab64aab77d74252b9c08445cd46b595d84 (patch) | |
tree | abd6524870368dd461411eb9cca82075178cb3e6 | |
parent | d644d4a9ca114ceb5d6e69f0c0df6cd571bb33c4 (diff) |
handle aliases in getConstAsOffset
-rw-r--r-- | lib/Target/JSBackend/JSBackend.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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<GlobalAlias>(V)) { + V = GA->getAliasee(); + } if (const Function *F = dyn_cast<const Function>(V)) { return getFunctionIndex(F); } else if (const BlockAddress *BA = dyn_cast<const BlockAddress>(V)) { |