[llvm] 40109fa - [NFC][Alignment] Use proper type in LLVMGetAlignment

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 06:00:00 PDT 2022


Author: Guillaume Chatelet
Date: 2022-06-13T12:59:37Z
New Revision: 40109fa101017717893b4fea132ba39bbf20fec1

URL: https://github.com/llvm/llvm-project/commit/40109fa101017717893b4fea132ba39bbf20fec1
DIFF: https://github.com/llvm/llvm-project/commit/40109fa101017717893b4fea132ba39bbf20fec1.diff

LOG: [NFC][Alignment] Use proper type in LLVMGetAlignment

Added: 
    

Modified: 
    llvm/lib/IR/Core.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 4a71187933d8..c5759cf53599 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2075,13 +2075,13 @@ LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global) {
 unsigned LLVMGetAlignment(LLVMValueRef V) {
   Value *P = unwrap<Value>(V);
   if (GlobalObject *GV = dyn_cast<GlobalObject>(P))
-    return GV->getAlignment();
+    return GV->getAlign() ? GV->getAlign()->value() : 0;
   if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
-    return AI->getAlignment();
+    return AI->getAlign().value();
   if (LoadInst *LI = dyn_cast<LoadInst>(P))
-    return LI->getAlignment();
+    return LI->getAlign().value();
   if (StoreInst *SI = dyn_cast<StoreInst>(P))
-    return SI->getAlignment();
+    return SI->getAlign().value();
   if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
     return RMWI->getAlign().value();
   if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(P))


        


More information about the llvm-commits mailing list