https://llvm.org/bugs/show_bug.cgi?id=27255

Reid Kleckner <r...@google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |r...@google.com
         Resolution|INVALID                     |---

--- Comment #2 from Reid Kleckner <r...@google.com> ---
So, doing pointer arithmetic off of null may be UB in C strictly speaking, but
I think optimizing based on that at the LLVM level has soundness issues.

I would expect the following LLVM transform to be semantics preserving, but you
are saying it isn't:

%0 = ptrtoint i8* %myptr, i64
%1 = add i64 0, i64 %0
%2 = inttoptr i64 %1, i8*
%3 = load i8, i8* %2
=>
%0 = ptrtoint i8* %myptr, i64
%1 = getelementptr i8* null, i64 %0
%2 = load i8, i8* %1

Why should it matter to instcombine whether the valid pointer comes from the
base or the index of the GEP?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to