[LLVMbugs] [Bug 19270] New: Check address space when optimizing gep+cast

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 27 16:46:49 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19270

            Bug ID: 19270
           Summary: Check address space when optimizing gep+cast
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: wujingyue at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12304
  --> http://llvm.org/bugs/attachment.cgi?id=12304&action=edit
unoptimized

visitGetElementPtr in InstructionCombining.cpp gets rid of unnecessary pointer
casts in gep (cast X). However, this optimization may change the address space
of the result pointer type, and cause type mismatch. 

I attached a very simple test to reproduce this issue. Run:

opt -S -O3 gep.ll -o gep.opt.ll
opt -verify gep.opt.ll -disable-output

The verifier will complain about the type mismatch. 

I attached a patch that disables this optimization when the address space of
the source is different from that of the destination. If it looks good to you,
I'll send it to llvm-commits for review. 

Jingyue

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140327/481f730b/attachment.html>


More information about the llvm-bugs mailing list