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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to