[PATCH] D20769: [IPRA] Interprocedural Register Allocation - Analysis Passes

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 08:46:50 PDT 2016


mehdi_amini added inline comments.

================
Comment at: lib/CodeGen/RegUsageInfoCollector.cpp:130
@@ +129,3 @@
+
+  PRUI->storeUpdateRegUsageInfo(Mdl->getNamedGlobal(MF.getName()),
+                                std::move(RegMask));
----------------
vivekvpandya wrote:
> mehdi_amini wrote:
> > This is not the right API: `getNamedGlobal` is for global *variables*, not function.
> I tried out 
> 
> ```
> PRUI->storeUpdateRegUsageInfo(Mdl->getGlobalVariable(MF.getFunction()->getName(),true), std::move(RegMask));
> ```
> and 
> 
> ```
> PRUI->storeUpdateRegUsageInfo(Mdl->getGlobalVariable(MF.getFunction()->getName()), std::move(RegMask));
> ```
> but both returns nullptr for some functions.
My previous comment called out the fact that you were using an API for global *variables* instead of function, and you replaced with a call to `getGlobalVariable`?

There is a `getFunction()` API on the module that returns only functions, or there is a getNamedValue() that will return any symbol.

However you have `MF.getFunction()`, so you should not call any of these.


http://reviews.llvm.org/D20769





More information about the llvm-commits mailing list