[NFC][Alignment] Use proper type in LLVMGetAlignment
authorGuillaume Chatelet <gchatelet@google.com>
Mon, 13 Jun 2022 12:46:57 +0000 (12:46 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Mon, 13 Jun 2022 12:59:37 +0000 (12:59 +0000)
llvm/lib/IR/Core.cpp

index 4a71187..c5759cf 100644 (file)
@@ -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))