Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstCombineCalls.cpp:786: llvm::Instruction* moveAddAfterMinMax(llvm::IntrinsicInst*, llvm::InstCombiner::BuilderTy&): Assertion `!Overflow && "Expected simplify of min/max"' failed. #52884

Closed
regehr opened this issue Dec 26, 2021 · 1 comment
Labels
compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm:codegen

Comments

@regehr
Copy link
Contributor

regehr commented Dec 26, 2021

https://gcc.godbolt.org/z/z7c3xx86Y

opt -instcombine crashes on this IR:


define i8 @smax_offset(i8 %x) {
  %1 = add nuw nsw i8 50, %x
  %m = call i8 @llvm.smax.i8(i8 %1, i8 -124)
  ret i8 %m
}

this was found by my student @Hatsunespica

@RKSimon RKSimon added compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm:codegen labels Dec 27, 2021
@rotateright
Copy link
Contributor

InstCombine is expecting InstSimplify to squash the pattern before it gets too far, but the analysis got thwarted by having both "nuw" and "nsw" on the add.

Proposed fix:
https://reviews.llvm.org/D116322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm:codegen
Projects
None yet
Development

No branches or pull requests

4 participants