]> granicus.if.org Git - llvm/commit
[GVNHoist] safeToHoistLdSt allows illegal hoisting
authorAlexandros Lamprineas <alexandros.lamprineas@arm.com>
Mon, 23 Jul 2018 09:42:35 +0000 (09:42 +0000)
committerAlexandros Lamprineas <alexandros.lamprineas@arm.com>
Mon, 23 Jul 2018 09:42:35 +0000 (09:42 +0000)
commitdbf6cfb47d5e47ce638a275a5c865a9fbb9e0b97
tree1dfe61e0287ed350b9c922558db33b1b11969ac6
parentd0f4fb1b00cb9f52ccc92a67d0f34f1a2f28faeb
[GVNHoist] safeToHoistLdSt allows illegal hoisting

Bug fix for PR36787. When reasoning if it's safe to hoist a load we
want to make sure that the defining memory access dominates the new
insertion point of the hoisted instruction. safeToHoistLdSt calls
firstInBB(InsertionPoint,DefiningAccess) which returns false if
InsertionPoint == DefiningAccess, and therefore it falsely thinks
it's safe to hoist.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337674 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVNHoist.cpp
test/Transforms/GVNHoist/pr36787.ll [new file with mode: 0644]