summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorJob Noorman <jnoorman@igalia.com>2023-04-13 14:29:18 +0200
committerJob Noorman <jnoorman@igalia.com>2023-04-13 14:29:19 +0200
commitdf3f1e2f31300f95845c39a76a45c95dab64cd12 (patch)
tree43da31d56e73931432c5ce0d6019a4d3d5156e19 /bolt
parentb3ed6e545568a2b483561b416c36942ce2e5d2a2 (diff)
downloadllvm-df3f1e2f31300f95845c39a76a45c95dab64cd12.tar.gz
[BOLT][NFC] Fix UB due to left shift of negative value
The following test fails when enabling UBSan due to a left shift of a negative value: > runtime error: left shift of negative value -2 BOLT :: AArch64/ext-island-ref.s This patch fixes this by using a multiplication instead of a shift. Reviewed By: yota9 Differential Revision: https://reviews.llvm.org/D148218
Diffstat (limited to 'bolt')
-rw-r--r--bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
index ec9f78d48981..90016ed2cd15 100644
--- a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -265,7 +265,7 @@ public:
return true;
}
- DispImm = Inst.getOperand(I).getImm() << 2;
+ DispImm = Inst.getOperand(I).getImm() * 4;
return true;
}
return false;