[PATCH] [ARM] Align stack objects passed to functions

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 4 09:11:25 PST 2015

Can you please put this into CodeGenPrep proper (with some target hook to enable it). I likely want to use this for PowerPC too, and the actual logic is fairly simple (so far).


Comment at: lib/Target/ARM/ARMAlignAllocaPass.cpp:32
@@ +31,3 @@
+  public:
+    ARMAlignAlloca(const ARMBaseTargetMachine &TM) : FunctionPass(ID), DL(TM.getDataLayout()) { }
+    bool runOnFunction(Function &F) override;
Line too long?

Comment at: lib/Target/ARM/ARMAlignAllocaPass.cpp:62
@@ +61,3 @@
+    if (User *U = dyn_cast<User>(Arg.get()))
+      for (auto *Val : U->operand_values())
+        tryAlignAlloca(Val);
What are you actually trying to check for here? I assume you're mostly interested in looking for GEPs here (and not, for example, ptrtoint). Also, for GEPs, do you want to check that the offet to the underlying alloca is divisible by the alignment of interest. Maybe you should use something like Val->stripAndAccumulateInBoundsConstantOffsets() -- true, you'd miss the dynamic offset case, but I don't know if you have examples where that's important.



More information about the llvm-commits mailing list