[llvm] 1bd928e - [AArch64InstPrinter] Use * 4096 instead of << 12

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 14:02:31 PST 2020


Author: Fangrui Song
Date: 2020-12-16T14:02:25-08:00
New Revision: 1bd928e50bb85a1ab8440473abd2a0a4ecd1349a

URL: https://github.com/llvm/llvm-project/commit/1bd928e50bb85a1ab8440473abd2a0a4ecd1349a
DIFF: https://github.com/llvm/llvm-project/commit/1bd928e50bb85a1ab8440473abd2a0a4ecd1349a.diff

LOG: [AArch64InstPrinter] Use * 4096 instead of << 12

Left shirting a negative integer is undefined before C++20.

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index a372298740ea..67f6cf40a727 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -1386,7 +1386,7 @@ void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, uint64_t Address,
   // If the label has already been resolved to an immediate offset (say, when
   // we're running the disassembler), just print the immediate.
   if (Op.isImm()) {
-    const int64_t Offset = Op.getImm() << 12;
+    const int64_t Offset = Op.getImm() * 4096;
     if (PrintBranchImmAsAddress)
       O << formatHex((Address & -4096) + Offset);
     else


        


More information about the llvm-commits mailing list