[llvm-dev] If-converter breaking condition data dependency
Diogo Sampaio via llvm-dev
llvm-dev at lists.llvm.org
Fri Sep 24 08:53:43 PDT 2021
Hi,
I'm trying to use if-converter to generate conditional load instructions. However I'm acing a data-dependency issue such as this one:
The original code would output as this:
compw.eq $r0 = $r1, $r0 <= condition is stored in r0
;;
cb.even $r0 ? .LBB72_9 <= branch if r0 is even
;;
ld $r0 = 16[$r20] <= only loads if r0 is odd
;;
ld $r20 = 8[$r0] <= only loads if r0 is odd
;;
.LBB72_9:
if-converter would change it to this:
compw.eq $r0 = $r1, $r0 <= same condition in same register
;;
ld.odd $r0 ? $r0 = 16[$r20] <= ko. The condition is overwritten.
;;
ld.odd $r0 ? $r20 = 8[$r0] <= ko. Load occurs depending on the new loaded value.
In none of the TargetInstructionInfo hooks we obtain both the basic block and branch conditions to detect this break of data dependency, although I imagine the if-converter should be the one doing so.
At best, isProfitableToIfCvt should also receive the branch conditions, so it could detect this case.
Am I missing something?
Did anyone else face such issue?
Btw, we're still using llvm 12.0.1.
Thanks in advance.
Diogo Sampaio
Senior Compiler Engineer • Kalray
dsampaio at kalrayinc.com • [ https://www.kalrayinc.com/ | www.kalrayinc.com ]
More information about the llvm-dev
mailing list