[LLVMbugs] [Bug 22469] New: Missing instcombine for mix of gep and bitcasts
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Feb 4 16:22:25 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22469
Bug ID: 22469
Summary: Missing instcombine for mix of gep and bitcasts
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: listmail at philipreames.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
I ran across this test case the other day. It really seems like we should be
able to represent this as a single GEP given that we know the size of the
pointers involved.
; ModuleID = 'gep-test.ll'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux"
%Type2 = type { [8 x i8] }
%Type1 = type { [8 x i8] }
; Function Attrs: nounwind readnone
define %Type2 addrspace(1)* addrspace(1)* @test(%Type2 addrspace(1)* readnone
%ptr, i64 %idx) #0 {
%gep1 = getelementptr inbounds %Type2 addrspace(1)* %ptr, i64 8, i32 0, i64 0
%bc1 = bitcast i8 addrspace(1)* %gep1 to %Type1 addrspace(1)* addrspace(1)*
%gep2 = getelementptr inbounds %Type1 addrspace(1)* addrspace(1)* %bc1, i64
%idx
%final = bitcast %Type1 addrspace(1)* addrspace(1)* %gep2 to %Type2
addrspace(1)* addrspace(1)*
ret %Type2 addrspace(1)* addrspace(1)* %final
}
Note that we do emit a single "leaq" for this when run through LLC. It's only
at the IR level that we're uglier than we need to be.
--
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/20150205/79ba7944/attachment.html>
More information about the llvm-bugs
mailing list