[PATCH] D116332: [ConstantFold] Make icmp of gep fold offset based

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 28 09:11:33 PST 2021


nikic marked 2 inline comments as done.
nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:1257
+    // signed.
+    CmpInst::Predicate CmpPred = (CmpInst::Predicate)Predicate;
+    if (Ops0->getType()->isPointerTy() &&
----------------
spatel wrote:
> Similar to your comment in D116168 - I'm not sure why we specify this parameter as `unsigned` instead of the actual enum. I see that we are not including any headers via ConstantFolding.h, so maybe there's some compile-time justification for it?
Yeah, I believe the reason for the `unsigned` is that it's impossible to forward-declare a nested type in C++.

What do you think about the new variant that does a cast right at the start of the function?


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

https://reviews.llvm.org/D116332



More information about the llvm-commits mailing list