[llvm] 7a5b0a2 - Reapply "IR: Make getRetAlign check callee function attributes"

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 24 06:26:55 PST 2022


Author: Matt Arsenault
Date: 2022-01-24T09:26:51-05:00
New Revision: 7a5b0a2934f3b82ae93f03d1e7603371fe5c42d1

URL: https://github.com/llvm/llvm-project/commit/7a5b0a2934f3b82ae93f03d1e7603371fe5c42d1
DIFF: https://github.com/llvm/llvm-project/commit/7a5b0a2934f3b82ae93f03d1e7603371fe5c42d1.diff

LOG: Reapply "IR: Make getRetAlign check callee function attributes"

Reapply 3d2d208f6a0a421b23937c39b9d371183a5913a3, reverted in
a97e20a3a8a58be751f023e610758310d5664562

Added: 
    

Modified: 
    llvm/include/llvm/IR/InstrTypes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 179aa579fa96..b3d2a2c8ed9d 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1723,7 +1723,13 @@ class CallBase : public Instruction {
   }
 
   /// Extract the alignment of the return value.
-  MaybeAlign getRetAlign() const { return Attrs.getRetAlignment(); }
+  MaybeAlign getRetAlign() const {
+    if (auto Align = Attrs.getRetAlignment())
+      return Align;
+    if (const Function *F = getCalledFunction())
+      return F->getAttributes().getRetAlignment();
+    return None;
+  }
 
   /// Extract the alignment for a call or parameter (0=unknown).
   MaybeAlign getParamAlign(unsigned ArgNo) const {


        


More information about the llvm-commits mailing list