aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-04-26 10:00:42 +0200
committerNikita Popov <npopov@redhat.com>2023-04-28 14:31:23 +0200
commit0659000ff79decc1173aac140d4b0325fe696c57 (patch)
tree2504e79347ab0b4cf595e81b54c684570e192c60 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parent78d8d016490909ac759c6f76c5f8679bc7a58b2e (diff)
downloadllvm-0659000ff79decc1173aac140d4b0325fe696c57.zip
llvm-0659000ff79decc1173aac140d4b0325fe696c57.tar.gz
llvm-0659000ff79decc1173aac140d4b0325fe696c57.tar.bz2
[LICM] Don't duplicate instructions just because they're free
D37076 makes LICM duplicate instructions into exit blocks if the instruction is free. For GEPs, the motivation appears to be that this allows the GEP to be folded into addressing modes, while non-foldable users outside the loop might prevent this. TBH I don't think LICM is the place to do this (why doesn't CGP apply this heuristic itself?) but at least I understand the motivation. However, the transform is also applied to all other "free" instructions, which are just that (removed during lowering and not "folded" in some way). For such instructions, this transform seems somewhere between useless, counter-productive (undoing CSE/GVN) and actively incorrect. For example, this transform can duplicate freeze instructions, which is illegal. This patch limits the transform to just foldable GEPs, though we might want to drop it from LICM entirely as a followup. This is a small compile-time improvement, because querying TTI cost model for every single instruction is expensive. Differential Revision: https://reviews.llvm.org/D149136
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions