]> granicus.if.org Git - llvm/commit
[SimplifyCFG] Do not sink and merge inline-asm instructions.
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 25 Jan 2017 06:21:51 +0000 (06:21 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 25 Jan 2017 06:21:51 +0000 (06:21 +0000)
commitf2d33f98a8b79aa8be613fe7c9147c3e1331f0c2
tree8b3c87b38056f9a0e03d4c9a4f242fafe28a6201
parent9291d3c697a3b4286af02f706516b0d015f11ee3
[SimplifyCFG] Do not sink and merge inline-asm instructions.

Conservatively disable sinking and merging inline-asm instructions as doing so
can potentially create arguments that cannot satisfy the inline-asm constraints.

For example, SimplifyCFG used to do the following transformation:

(before)
if.then:
  %0 = call i32 asm "rorl $2, $0", "=&r,0,n"(i32 %r6, i32 8)
  br label %if.end
if.else:
  %1 = call i32 asm "rorl $2, $0", "=&r,0,n"(i32 %r6, i32 6)
  br label %if.end

(after)
  %.sink = select i1 %tobool, i32 6, i32 8
  %0 = call i32 asm "rorl $2, $0", "=&r,0,n"(i32 %r6, i32 %.sink)

This would result in a crash in the backend since only immediate integer operands
are permitted for constraint "n".

rdar://problem/30110806

Differential Revision: https://reviews.llvm.org/D29111

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293025 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/sink-common-code.ll