[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 06:19:52 PST 2023


nikic added a comment.

I've found another bug in LLVM, fixed with https://github.com/llvm/llvm-project/commit/78f88082de3627ea04501c83a08f52cf1e60b4f7. After that change, the test case from https://github.com/llvm/llvm-project/issues/59580 appears to be handled correctly, it contains this in the final IR:

  br i1 icmp ugt (ptr getelementptr ([0 x i8], ptr @end, i64 0, i64 536870911), ptr @end), label %if.then, label %if.else9

As such, I'm not sure if we actually need any change in Clang, as it seems like this was ultimately due to LLVM bugs. At least we would need a different test case, as the `inbounds.c` test case is already getting compiled correctly without this patch.



================
Comment at: llvm/include/llvm/IR/ConstantFold.h:29
   template <typename T> class ArrayRef;
+  inline bool SignedWrap = false;
+
----------------
These changes shouldn't be needed anymore.


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

https://reviews.llvm.org/D142872



More information about the cfe-commits mailing list