Reapply "[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond)" by steakhal · Pull Request #129234 · llvm/llvm-project (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@steakhal

@steakhal

@steakhal

The append_range was accidentally executed for each CXXAssumeAttr.

This caused the the ThreadSafety analysis to misbehave on code like this:

template <class ExecutionPolicy>
void transform(ExecutionPolicy) {
  #pragma clang loop vectorize(enable) interleave(enable)
  for (int __i = 0; 0;) {
    // empty
  }
}
void entrypoint() {
  transform(1);
}

In the transform() somehow the ThreadSafety analysis would have a malformed CFG for the function, breaking invariants inside their algorithm, causing an assertion to fire and break some libcxx build bot.

I also noticed that CFGBuilder::VisitAttributedStmt would "build" the blocks for an AttributedStmt iff that holds both the Fallthrough and the assume attributes. So I fixed that too.

Xazax-hun

@steakhal

@steakhal

@steakhal

Xazax-hun

@steakhal

@steakhal

Xazax-hun

@steakhal steakhal deleted the reland-csa-assume-attr-modeling branch

March 6, 2025 07:09