[llvm-dev] Is the correct behavior of getelementptr i192* for opt + llc -march=aarch64?

MITSUNARI Shigeo via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 8 21:48:14 PST 2016


Hi Tim,

-------------------------------------------
% cat a.ll
define void @store0_to_p4(i192* %p)
{
  %p1 = bitcast i192* %p to i64*                 ; (X)
  %p2 = getelementptr i64, i64* %p1, i64 3       ; (X)
  %p3 = getelementptr i64, i64* %p2, i64 1
  store i64 0, i64* %p3
  ret void
}
-------------------------------------------
% opt-3.8 -O3 a.ll -S
; ModuleID = 'a.ll'

; Function Attrs: norecurse nounwind
define void @store0_to_p4(i192* nocapture %p) #0 {
  %p21 = getelementptr i192, i192* %p, i64 1        ; (Y)
  %p2 = bitcast i192* %p21 to i64*
  %p3 = getelementptr i64, i64* %p2, i64 1
  store i64 0, i64* %p3, align 4
  ret void
}

attributes #0 = { norecurse nounwind }
-------------------------------------------

>This looks like it's because the IR doesn't contain a datalayout
>declaration, which affects how i192 is interpreted (particularly
>sizeof(i192) for GEP purposes).

I think that (X) != (Y) for aarch64, but I don't know how to provide
a correct datalayout, then I will avoid using i192*.

Thank you.

Yours,
 Shigeo




More information about the llvm-dev mailing list