Hi I have the following IR, I would like to get either ConstantFP or ConstantFPSDNode on the operand of this foo ( SDNode ) here’s what I see in gdb, I see that this float value is not lowered to a DAG constant, instead it is a load from a constant pool. I need to get this constant value in ConstantFP
or ConstantFPSDNode
for which I’m trying to do some canonicalization on the APFloat
of this Constant FP value. Operand
is the load from constant pool instruction.
%c = call float @foo(float 0x40091EB860000000) ; fp = 3.14
gdb dump
t11: i64 = X86ISD::Wrapper TargetConstantPool:i64<float 0x40091EB860000000> 0
t9: f32,ch = load<(load (s32) from constant-pool)> t0, t11, undef:i64
t2: f32 = foo t9
Basically this is what I’m trying to do.
const ConstantFP *CFP = ...(Operand)
if (CFP) {
const APFloat &C = CFP->getValueAPF();
I tried the following but it does not work.
ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(Operand)
if (CFP) {
const APFloat &C = CFP->getValueAPF();