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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 10:00:41 PDT 2022


aprantl 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);
----------------
fdeazeve wrote:
> 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
Ah okay, that makes sense!


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