<div dir="ltr">Hi,<br><br>Is there a way, given an LLVM IR file, to produce assembly and _only_ run the register allocator? <br>Or, maybe the register allocation is coupled with, I don't know..<br>instruction selection. But I guess it's not coupled with many back-end optimizations,<br>e.g., back-end LICM, CSE and DCE are not included.<br><br>I am writing some _middle-end_ passes and I'd like to check their actual effect on<br>assembly and run-time, e.g., of the optimized vs unoptimized version. This implies that<br>I should minimize the effect of back-end optimizations but also keep a minimum code quality.<br>Right now, I'm producing an .ll file and I'm passing it to llc.<br><br>On the one hand, if I run no optimizations in llc (-O0), specifically due to the<br>absence of regalloc, the code is pretty bad and as far as I can tell, I won't be able<br>to ever see the effect of the middle-end optimizations because the bottle-neck will be loading from and storing to stack.<br><br>On the other hand, if I run e.g., even -O1, it seems it does optimizations like<br>LICM, CSE and DCE. Those are some of the optimizations of which I have written my versions<br>in the middle-end and whose effect I want to check. If llc applies its own version, then I can't<br>see any difference between my optimized and the "unoptimized" version.<br><br>Running: llc test.ll -regalloc=... doesn't work because the default optimization level<br>is -O2 in llc.<br><br>I'm not familiar with the back-end and any help would be appreciated. Also, feel free<div>to give advice on checking the effect of middle-end optimizations in general.<br><br>Best,<br>Stefanos<br><br></div></div>