Context
The relationship between %temp and %or is as follows:
%temp = zext i8 %y to i32
%shl1 = shl i32 %x, 8
%or = or i32 %shl1, %temp
%shl2 = shl i32 %or, 25
SimplifyDemandedUseBits
function in instcombine pass can transform %shl2 = shl i32 %or, 25
to %shl2 = shl i32 %temp, 25
.
Question
Is there a way to know that above mentioned transformation can happen without actually modifying IR? I am modifying instcombine pass and want to take some decision based on this analysis.
I know there is a demanded-bits analysis pass but the constructor of the DemandedBits
class is defined as:
DemandedBits(Function &F, AssumptionCache &AC, DominatorTree &DT)
I don’t know how to initialize object for this class, as I only have the instruction I
and InstCombinerImpl IC
.