summaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackMaps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/StackMaps.cpp')
-rw-r--r--lib/CodeGen/StackMaps.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/StackMaps.cpp b/lib/CodeGen/StackMaps.cpp
index 1dc76d5c6a..d70e6b3044 100644
--- a/lib/CodeGen/StackMaps.cpp
+++ b/lib/CodeGen/StackMaps.cpp
@@ -207,7 +207,10 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID,
// Move large constants into the constant pool.
for (LocationVec::iterator I = Locations.begin(), E = Locations.end();
I != E; ++I) {
- if (I->LocType == Location::Constant && (I->Offset & ~0xFFFFFFFFULL)) {
+ // Constants are encoded as sign-extended integers.
+ // -1 is directly encoded as .long 0xFFFFFFFF with no constant pool.
+ if (I->LocType == Location::Constant &&
+ ((I->Offset + (int64_t(1)<<31)) >> 32) != 0) {
I->LocType = Location::ConstantIndex;
I->Offset = ConstPool.getConstantIndex(I->Offset);
}