[PATCH] Handle some cases of mismatched types in IRCE

Sanjoy Das sanjoy at playingwithpointers.com
Wed Jan 21 00:48:23 PST 2015


Hi reames, hfinkel,

There are places where the inductive range check elimination pass depends on two `llvm::Value`s or `llvm::SCEV`s to be of the same `llvm::Type` when they do not need to be.  This patch relaxes those restrictions, and adds test cases to trigger those paths.

Three things to note:

 * These issues were found by bootstrapping clang with IRCE running in the `-O3` pass ordering.
 * I will follow up with a change that factors out an independent `Range` construct -- things like `Range.first->getType()` are ugly.
 * I have not added a test case that exercises the `CIVComparedToSCEV->getType() != LatchCount->getType())` part of the change.  That part of the change is needed when `-indvars` widens the induction variable, but leaves behind the old cached value for a loop's backedge taken count in scalar evolution (so the types mismatch but the actual value of the backedge-taken-count is still accurate).  So far I have not managed to reproduce this problem outside of clang.

http://reviews.llvm.org/D7082

Files:
  lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
  test/Transforms/IRCE/bug-mismatched-types.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7082.18486.patch
Type: text/x-patch
Size: 4842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150121/816f1fb5/attachment.bin>


More information about the llvm-commits mailing list