The given sequence of instructions: a = fadd(x, y) b = fadd(x, z) r = clamp(max(a, b), 0.0, 1.0) is definitely not equivalent to: r = fadd(x, y) with clamp enabled This is because we don't check that source operands of max() are equivalent before folding the instruction. This has been reported by Alex Smith (Feral).
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Thanks for accepting this review. What kind of comment do you think should be useful?
Also, could you push the patch for me? I don't have LLVM commit rights.
Comment Actions
Mostly it took me a while to grok why the function was looking at MAX instructions. As far as I understand now, it's because the code that deduces the clamp output modifier happens to always produce it on a MAX(x,x) instruction, and not a MIN.