[llvm-dev] Instcombine Creating Illegal Code? (in LLVM 7)

William Moses via llvm-dev
Fri, 28 Jun 2019 07:52:01 -0000

Hi all,

I was playing around with LLVM 7 and I discovered something that seems to
me to be a bug -- or at least something that I don't understand.

Take the following valid simple program and run -instcombine on it

declare i8* @malloc(i64)

define void @caller() {
entry:
  call void @callee()
  ret void
}

define fastcc void @callee() {
entry:
  %malloccall = call i8* @malloc(i64 9)
  store i8 0, i8* %malloccall
  ret void
}


It get's transformed into the following invalid code after the optimization
(now having an illegal store):

; ModuleID = 'blarg.ll'
source_filename = "blarg.ll"

declare i8* @malloc(i64)

define void @caller() {
entry:
  store i1 true, i1* undef, align 1
  ret void
}

define fastcc void @callee() {
entry:
  ret void
}

Anyone seen this before and/or could shed some light on this behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20190628/2d8693b6/attachment.html>