[InstCombine] Use poison constant to represent the result of unreachable instrs
authorJuneyoung Lee <aqjune@gmail.com>
Sun, 20 Jun 2021 06:00:15 +0000 (15:00 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Mon, 21 Jun 2021 00:58:44 +0000 (09:58 +0900)
commitce192ced2b901be67444c481ab5ca0d731e6d982
tree270ad73c05b7507df0cffcde6e7338ccd63c4952
parente6cb55d5ceb8e3f623814779ba4fc0c1e003e9fa
[InstCombine] Use poison constant to represent the result of unreachable instrs

This patch updates InstCombine to use poison constant to represent the resulting value of (either semantically or syntactically) unreachable instrs, or a don't-care value of an unreachable store instruction.

This allows more aggressive folding of unused results, as shown in llvm/test/Transforms/InstCombine/getelementptr.ll .

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D104602
12 files changed:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/GVN/PRE/2017-06-28-pre-load-dbgloc.ll
llvm/test/Transforms/InstCombine/atomic.ll
llvm/test/Transforms/InstCombine/builtin-object-size-ptr.ll
llvm/test/Transforms/InstCombine/getelementptr.ll
llvm/test/Transforms/InstCombine/load.ll
llvm/test/Transforms/InstCombine/pr44245.ll
llvm/test/Transforms/InstCombine/store.ll