[PATCH] D37832: Eliminate PHI (int typed) which is only used by inttoptr

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 11:30:56 PST 2020


rnk added inline comments.
Herald added a subscriber: javed.absar.
Herald added a project: LLVM.


================
Comment at: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp:244
+      if (isa<PHINode>(IncomingI))
+        InsertPos = IncomingI->getParent()->getFirstInsertionPt();
+      InsertNewInstBefore(CI, *InsertPos);
----------------
I believe this line of code caused a clang crash with Windows EH:
https://llvm.org/pr45033

getFirstInsertionPt returns an iterator which may be an end iterator, which cannot be cast to Instruction*. This case arises for catchswitch blocks, which have no valid insertion point.

I will put together a fix, but I figured I should alert folks to this corner case to avoid such problems in the future.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D37832/new/

https://reviews.llvm.org/D37832





More information about the llvm-commits mailing list