[llvm-dev] Removing constants from a constant array?

Nicolai Davidsson via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 16 20:08:19 PST 2017


Hi,

I’m currently writing a LLVM pass and would like to modify a constant array based on some basic analysis.

Is there any way to simply remove entries (`llvm::Constant`) from an array (`llvm::ConstantArray`)? Replacing all uses with an undefined value doesn’t work as the array is terminated by an undefined value, subsequent elements thus are ignored at runtime. I’d rather avoid re-creating the entire array from scratch and replace the existing array with it but I’m afraid there’s not many other options.

Is there any solution I’m not aware of yet?

Thanks,
Nicolai  


More information about the llvm-dev mailing list