LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 30742 - loop vectorizer causes dominance violation
Summary: loop vectorizer causes dominance violation
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Loop Optimizer (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-19 18:13 PDT by Eric Schweitz
Modified: 2017-01-09 14:10 PST (History)
7 users (show)

See Also:
Fixed By Commit(s):


Attachments
-loop-vectorize bug (1.31 KB, application/octet-stream)
2016-10-19 18:13 PDT, Eric Schweitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Schweitz 2016-10-19 18:13:25 PDT
Created attachment 17462 [details]
-loop-vectorize bug

The attached program shows a failure in opt's loop vectorizer pass. I believe this failure has been present for several releases, and I have replicated it with trunk, 3.9, etc.

% opt bug.bc -verify -disable-output
% opt bug.bc -loop-vectorize -disable-output
Instruction does not dominate all uses!
  %49 = select i1 %48, i32 1, i32 %47
  %43 = add i32 %49, -7
LLVM ERROR: Broken function found, compilation aborted!
Comment 1 Matthew Simpson 2016-10-26 14:06:55 PDT
I believe the vectorizer must not be keeping the dominator tree up to date properly. It looks like a SCEVExpander is generating code in an unexpected place.
Comment 2 Matthew Simpson 2017-01-03 14:42:36 PST
Patch submitted here: https://reviews.llvm.org/D28168
Comment 3 Matthew Simpson 2017-01-09 14:10:05 PST
Fix committed in r291462. The patch delays the fix-up operation for external induction variable users until after the dominator tree has been updated. But we should work towards keeping the dominator tree up-to-date throughout the transformation, rather than updating it at the end.