[PATCH] D71164: [InstCombine] Fix infinite loop due to bitcast <-> phi transforms
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 10:07:13 PST 2020
nikic marked 3 inline comments as done.
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2325-2327
+ NewV = combineLoadToNewType(*LI, DestTy);
+ replaceInstUsesWith(*LI, UndefValue::get(LI->getType()));
+ eraseInstFromFunction(*LI);
----------------
lebedev.ri wrote:
> I'm confused. Why are we replacing old `LI` with `undef` instead of `NewV`?
> This should be explained in the comment.
Added a comment. Keep in mind that the new load is going to have a different type, so it can't be replaced. The whole transform replaces one phi web with another, so we're free to stick undefs in the original one.
================
Comment at: llvm/test/Transforms/InstCombine/pr44245.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -instcombine -instcombine-infinite-loop-threshold=2 < %s | FileCheck %s
----------------
lebedev.ri wrote:
> Precommit
This is an infinite loop test. It's theoretically possible to precommit this because infinite loops are no longer infinite nowdays, but that means we have to mess with the exit code etc. I don't think there is any value in that, as we're not testing output anyway.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71164/new/
https://reviews.llvm.org/D71164
More information about the llvm-commits
mailing list