[PATCH] D130642: [GlobalISel] Handle IntToPtr constants in dbg.value

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 09:58:40 PDT 2022


fdeazeve added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:112
       MIB.addImm(CI->getZExtValue());
-  } else if (auto *CFP = dyn_cast<ConstantFP>(&C)) {
+  } else if (auto *CFP = dyn_cast<ConstantFP>(NumericConstant)) {
     MIB.addFPImm(CFP);
----------------
aprantl wrote:
> 1. I don't think this code path is tested?
> 2. Is this `inttoptr(float)` actually legal LLVM IR?
> Is this inttoptr(float) actually legal LLVM IR?

No, this kind of IR would fail the verifier

> I don't think this code path is tested?

I see the source of confusion now. I only changed this line to keep the spirit of the "type switch" that is going on here, i.e. the same value is tested on every branch.
For example, if the lambda ever changed to strip other things (for example some new float to ptr cast instruction), then the rest of the code wouldn't need to change.

Thoughts? I can argue both ways


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130642/new/

https://reviews.llvm.org/D130642



More information about the llvm-commits mailing list